-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrammar.txt
More file actions
66 lines (66 loc) · 1.59 KB
/
grammar.txt
File metadata and controls
66 lines (66 loc) · 1.59 KB
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
60
61
62
63
64
65
66
program -> deflist.
deflist -> tp def deflist.
deflist ->.
tp -> INT.
tp -> FLOAT.
tp -> INT LMB INUM RMB.
tp -> FLOAT LMB INUM RMB.
vallist -> ID COMMA vallist.
vallist -> ID.
def -> vallist SEMICOLON.
def -> fundef LGB stmtlist RGB.
fundef -> ID LLB args RLB.
fundef -> ID LLB RLB.
args -> param COMMA args.
args -> param.
param -> tp ID.
stmtlist -> stmt stmtlist.
stmtlist ->.
stmt -> exp SEMICOLON.
stmt -> tp vallist SEMICOLON.
stmt -> RETURN exp SEMICOLON.
stmt -> LGB stmt RGB.
stmt -> IF LLB exp RLB stmt.
stmt -> IF LLB exp RLB stmt1 ELSE stmt.
stmt -> WHILE LLB exp RLB stmt.
stmt -> FOR LLB initlist SEMICOLON exp SEMICOLON steplist RLB stmt.
initlist -> init COMMA initlist.
initlist -> init.
init -> ID ASSIGN exp.
init -> ID ADDEQ exp.
init -> ID MINUSEQ exp.
steplist -> step COMMA steplist.
steplist -> step.
step -> BIADD ID.
step -> ID BIADD.
step -> BIMINUS ID.
step -> ID BIMINUS.
step -> ID ASSIGN exp.
stmt1 -> IF LLB exp RLB stmt1 ELSE stmt1.
stmt1 -> WHILE LLB exp RLB stmt1.
stmt1 -> FOR LLB initlist SEMICOLON exp SEMICOLON steplist RLB stmt1.
exp -> exp BIAND exp.
exp -> exp BIOR exp.
exp -> exp LSS exp.
exp -> exp LSSEQ exp.
exp -> exp GRT exp.
exp -> exp GRTEQ exp.
exp -> exp EQ exp.
exp -> exp NOTEQ exp.
exp -> exp ADD exp.
exp -> exp MINUS exp.
exp -> exp MULTI exp.
exp -> exp DIV exp.
exp -> exp MOD exp.
exp -> INUM.
exp -> FNUM.
exp -> ID.
exp -> LLB exp RLB.
exp -> NOT exp.
exp -> exp AND exp.
exp -> exp OR exp.
exp -> exp XOR exp.
exp -> exp BITNOT exp.
exp -> exp COMMA exp.
exp -> ID LMB exp RMB.
exp -> exp ASSIGN exp.