forked from coolsidd/Compiler-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
machine_grammar.txt
59 lines (59 loc) · 1.66 KB
/
machine_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
52
53
54
55
56
57
58
59
main_program program ( ) { stmts }
stmts decl_stmts assign_stmts
decl_stmts decl_stmt decl_stmts
decl_stmts decl_stmt
assign_stmts assign_stmt assign_stmts
assign_stmts assign_stmt
decl_stmt decl_non_jagged
decl_stmt decl_jagged
decl_non_jagged declare list_of_identifiers : declaration_type
decl_jagged declare list_of_identifiers : jagged_array
list_of_identifiers list of variables id_list
list_of_identifiers ID
id_list ID id_list
id_list ID ID
declaration_type primitive_type ;
declaration_type rect_array ;
primitive_type integer
primitive_type real
primitive_type boolean
rect_array array range_list of primitive_type
range_list [ var .. var ] range_list
range_list [ var .. var ]
jagged_array jagged array jagged2list of primitive_type ; jagged2init
jagged_array jagged array jagged3list of primitive_type ; jagged3init
jagged2list range_list [ ]
jagged3list range_list [ ] [ ]
jagged2init R1 [ var ] : size var : values { j2list } jagged2init
jagged2init R1 [ var ] : size var : values { j2list }
j2list value_list ; j2list
j2list value_list
j2list ; j2list
j2list ;
jagged3init R1 [ var ] : size var : values { j3list } jagged3init
jagged3init R1 [ var ] : size var : values { j3list }
j3list value_list ; j3list
j3list value_list
j3list ; j3list
j3list ;
value_list var value_list
value_list var
index_list var index_list
index_list var
var ID [ index_list ]
var CONST
var ID
assign_stmt var_lhs = expr
var_lhs ID [ index_list ]
var_lhs ID
expr arithmeticexpr ;
arithmeticexpr term + arithmeticexpr
arithmeticexpr term - arithmeticexpr
arithmeticexpr term ||| arithmeticexpr
arithmeticexpr term
term fact * term
term fact / term
term fact &&& term
term fact
fact var
fact ( arithmeticexpr )