-
Notifications
You must be signed in to change notification settings - Fork 0
/
grammar.txt
55 lines (55 loc) · 2.06 KB
/
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
main_program -> PROGRAM LSIMPLE RSIMPLE LCURLY start RCURLY
start -> first second
first -> declaration first
first -> declaration
second -> assignment second
second -> assignment
declaration -> DECLARE declaration_ext
declaration_ext -> VAR COLON declaration_right_ext
declaration_ext -> LIST OF VARIABLES var_list COLON declaration_right_ext
declaration_right_ext -> prim_type SEMICOLON
declaration_right_ext -> ARRAY range_list OF INTEGER SEMICOLON
declaration_right_ext -> JAGGED ARRAY j_range_list
range_list -> LSQUARE id DOT id RSQUARE range_list
range_list -> LSQUARE id DOT id RSQUARE
j_range_list -> range_list_2 OF INTEGER SEMICOLON index_def_list_3
j_range_list -> range_list_3 OF INTEGER SEMICOLON index_def_list_3
var_list -> VAR var_list
var_list -> VAR VAR
prim_type -> INTEGER
prim_type -> BOOLEAN
prim_type -> REAL
range_list_2 -> LSQUARE id DOT id RSQUARE LSQUARE RSQUARE
range_list_3 -> LSQUARE id DOT id RSQUARE LSQUARE RSQUARE LSQUARE RSQUARE
id -> VAR
id -> NUMBER
index_def_list_3 -> index_def_3 index_def_list_3
index_def_list_3 -> index_def_3
index_def_3 -> R1 LSQUARE NUMBER RSQUARE COLON GSIZE NUMBER COLON VALUES LCURLY value_list_3 RCURLY
value_list_3 -> mini_value_list_3 SEMICOLON value_list_3
value_list_3 -> mini_value_list_3
mini_value_list_3 -> NUMBER mini_value_list_3
mini_value_list_3 -> NUMBER
new_value_list_3 -> VAR new_value_list_3
new_value_list_3 -> VAR
new_value_list_3 -> NUMBER new_value_list_3
new_value_list_3 -> NUMBER
assignment -> lhs EQUALS expression SEMICOLON
expression -> and_expression OP_OR expression
expression -> and_expression
and_expression -> arith_expression OP_AND and_expression
and_expression -> arith_expression
arith_expression -> term op_plus_minus arith_expression
arith_expression -> term
term -> factor op_mult_div term
term -> factor
factor -> VAR LSQUARE mini_value_list_3 RSQUARE
factor -> VAR LSQUARE new_value_list_3 RSQUARE
factor -> id
lhs -> VAR LSQUARE mini_value_list_3 RSQUARE
lhs -> VAR LSQUARE new_value_list_3 RSQUARE
lhs -> VAR
op_plus_minus -> OP_PLUS
op_plus_minus -> OP_MINUS
op_mult_div -> OP_MULT
op_mult_div -> OP_DIV