forked from juyaoliu/C-minus-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproductions.txt
52 lines (52 loc) · 1.71 KB
/
productions.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
P ::= N declare_list
declare_list ::= declare declare_list
declare_list ::= declare
declare ::= int ID M A function_declare
declare ::= int ID var_declare
declare ::= void ID M A function_declare
A ::=
var_declare ::= ;
function_declare ::= ( parameter ) sentence_block
parameter ::= parameter_list
parameter ::= void
parameter_list ::= param
parameter_list ::= param , parameter_list
param ::= int ID
sentence_block ::= { inner_declare sentence_list }
inner_declare ::=
inner_declare ::= inner_var_declare ; inner_declare
inner_var_declare ::= int ID
sentence_list ::= sentence M sentence_list
sentence_list ::= sentence
sentence ::= if_sentence
sentence ::= while_sentence
sentence ::= return_sentence
sentence ::= assign_sentence
assign_sentence ::= ID = expression ;
return_sentence ::= return ;
return_sentence ::= return expression ;
while_sentence ::= while M ( expression ) A sentence_block
if_sentence ::= if ( expression ) A sentence_block
if_sentence ::= if ( expression ) A sentence_block N else M A sentence_block
N ::=
M ::=
expression ::= add_expression
expression ::= add_expression > add_expression
expression ::= add_expression < add_expression
expression ::= add_expression == add_expression
expression ::= add_expression >= add_expression
expression ::= add_expression <= add_expression
expression ::= add_expression != add_expression
add_expression ::= item
add_expression ::= item + add_expression
add_expression ::= item - add_expression
item ::= factor
item ::= factor * item
item ::= factor / item
factor ::= NUM
factor ::= ( expression )
factor ::= ID ( argument_list )
factor ::= ID
argument_list ::=
argument_list ::= expression
argument_list ::= expression , argument_list