-
Notifications
You must be signed in to change notification settings - Fork 0
/
grammar.bnf
58 lines (49 loc) · 1.82 KB
/
grammar.bnf
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
52
53
54
55
56
57
58
statement ::= assignment | builtin
builtin ::= "store!" | "load!"
assignment ::= lefthand assignment_operator expression
assignment_operator ::= "=" |
"&=" |
"|=" |
"^=" |
"+=" |
"-=" |
"*="
expression ::= expression 'and' expression |
expression 'or' expression |
expression 'in' list |
expression '?' expression ':' expression |
expression '<' expression '<' expression |
expression '>' expression '>' expression |
expression '+' expression |
expression '-' expression |
expression '*' expression |
expression '&' expression |
expression '|' expression |
expression '^' expression |
expression '<' expression |
expression '>' expression |
expression '==' expression |
expression '<<' expression |
expression '>>>' expression |
expression '>>' expression |
'-' expression |
'(' expression ')' |
lefthand |
constant |
immediate
list ::= '[' element_list ']'
element_list ::= element_list, list_element |
list_element
list_element ::= lefthand | constant | immediate
lefthand ::= variable_name | "$" register_name
register_name ::= 'id_hi' |
'id_low' |
'id' |
'address_hi' |
'address_low' |
'address' |
'data' |
'mask'
variable ::= IDENTIFIER_VARIABLE
constant ::= '$constant[' INTEGER ']'
immediate ::= INTEGER | BINARY | HEX