-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlexical_grammar.txt
51 lines (48 loc) · 1.84 KB
/
lexical_grammar.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## Literals
<escaped_character> = \" | \\ | \/ | \b | \f | \n | \r | \t
<character> = any ASCII character except ", \, and the control characters | <escaped_character>
<characters> = <character> <character>*
<string> = "" | " <characters> "
<zero> = 0
<positive_digit> = [1..9]
<digit> = <zero> | <positive_digit>
<digits> = <digit> <digit>*
<integer> = <zero> | <positive_digit> <digit>*
<fractional_part> = . <digits>
<exponent_part> = (E | e) (+ | - | ε) <positive_digit> <digit>*
<decimal> = (<fractional_part> | <zero> <fractional_part>) (<exponent_part> | ε) |
<integer> <fractional_part> |
<integer> <exponent_part>
<letter> = [a-zA-Z]
<operator> = + | - | * | / | = | > | < | ! | & | % | ~ | $ | ^
<operator_extended> = <operator> | <operator> = | && | ||
<delimiter> = { | [ | ( | } | ] | ) | : | ,
<identifier> = (<letter> | _) (<letter> | <digit> | <operator> | _)*
<newline> = \n | \r\n
<comment> = // <character>* <newline>
## Keywords
<abstract> = abstract
<as> = as
<class> = class
<else> = else
<extends> = extends
<false> = false
<final> = final
<func> = func
<for> = for
<if> = if
<in> = in
<lazy> = lazy
<let> = let
<new> = new
<null> = null
<override> = override
<private> = private
<protected> = protected
<return> = return
<super> = super
<to> = to
<this> = this
<true> = true
<var> = var
<while> = while