1459 lines
30 KiB
Text
1459 lines
30 KiB
Text
Grammar
|
|
|
|
0 $accept: Program $end
|
|
|
|
1 Program: FunctionDef
|
|
2 | FunctionDef Program
|
|
|
|
3 Lines: Line
|
|
4 | Line Lines
|
|
|
|
5 Line: IfStatement
|
|
6 | WhileStatement
|
|
7 | Assignment
|
|
8 | Declarations
|
|
9 | FunctionCall
|
|
10 | Return
|
|
11 | Print
|
|
|
|
12 InnerBlock: tLBRACE tRBRACE
|
|
|
|
13 $@1: ε
|
|
|
|
14 InnerBlock: tLBRACE $@1 Lines tRBRACE
|
|
|
|
15 Condition: tLPAR ConditionalExpression tRPAR
|
|
|
|
16 ConditionalExpression: tID
|
|
17 | tNB
|
|
18 | tLPAR ConditionalExpression tRPAR
|
|
19 | NbOrVariable tLE NbOrVariable
|
|
20 | NbOrVariable tGE NbOrVariable
|
|
21 | NbOrVariable tEQ NbOrVariable
|
|
22 | NbOrVariable tNE NbOrVariable
|
|
23 | NbOrVariable tLT NbOrVariable
|
|
24 | NbOrVariable tGT NbOrVariable
|
|
25 | tNOT ConditionalExpression
|
|
26 | ConditionalExpression tOR ConditionalExpression
|
|
27 | ConditionalExpression tAND ConditionalExpression
|
|
|
|
28 NbOrVariable: tID
|
|
29 | tNB
|
|
|
|
30 IfStatement1: ε
|
|
|
|
31 $@2: ε
|
|
|
|
32 IfStatement: tIF Condition IfStatement1 InnerBlock tELSE $@2 InnerBlock
|
|
33 | tIF Condition IfStatement1 InnerBlock
|
|
|
|
34 $@3: ε
|
|
|
|
35 $@4: ε
|
|
|
|
36 WhileStatement: tWHILE $@3 Condition $@4 InnerBlock
|
|
|
|
37 Assignment: tID tASSIGN Expression tSEMI
|
|
|
|
38 Expression: NbOrVariable
|
|
39 | FunctionCall
|
|
40 | tLPAR Expression tRPAR
|
|
41 | Expression tADD Expression
|
|
42 | Expression tSUB Expression
|
|
43 | Expression tMUL Expression
|
|
44 | Expression tDIV Expression
|
|
|
|
45 Expressions: Expression
|
|
46 | Expression tCOMMA Expressions
|
|
|
|
47 FunctionCall: tID tLPAR Expressions tRPAR
|
|
|
|
48 FunctionDef: Type tID FunctionParams InnerBlock
|
|
49 | tVOID tID FunctionParams InnerBlock
|
|
|
|
50 FunctionParams: tLPAR tRPAR
|
|
51 | tLPAR tVOID tRPAR
|
|
52 | tLPAR VarsWithType tRPAR
|
|
|
|
53 VarsWithType: VarWithType
|
|
54 | VarWithType tCOMMA VarsWithType
|
|
|
|
55 VarWithType: Type tID
|
|
|
|
56 Type: tINT
|
|
57 | tFLOAT
|
|
|
|
58 $@5: ε
|
|
|
|
59 Declarations: Type $@5 Declaration Declarations1 tSEMI
|
|
|
|
60 Declaration: tID
|
|
|
|
61 $@6: ε
|
|
|
|
62 Declaration: tID $@6 tASSIGN Expression
|
|
|
|
63 Declarations1: tCOMMA Declaration Declarations1
|
|
64 | ε
|
|
|
|
65 Return: tRETURN Expression tSEMI
|
|
|
|
66 Print: tPRINT tLPAR Expression tRPAR tSEMI
|
|
|
|
|
|
Terminals, with rules where they appear
|
|
|
|
$end (0) 0
|
|
error (256)
|
|
tELSE (258) 32
|
|
tRETURN (259) 65
|
|
tPRINT (260) 66
|
|
tFLOAT (261) 57
|
|
tINT (262) 56
|
|
tVOID (263) 49 51
|
|
tSUB (264) 42
|
|
tADD (265) 41
|
|
tMUL (266) 43
|
|
tDIV (267) 44
|
|
tASSIGN (268) 37 62
|
|
tLT (269) 23
|
|
tGT (270) 24
|
|
tNE (271) 22
|
|
tEQ (272) 21
|
|
tGE (273) 20
|
|
tLE (274) 19
|
|
tAND (275) 27
|
|
tOR (276) 26
|
|
tNOT (277) 25
|
|
tLBRACE (278) 12 14
|
|
tRBRACE (279) 12 14
|
|
tLPAR (280) 15 18 40 47 50 51 52 66
|
|
tRPAR (281) 15 18 40 47 50 51 52 66
|
|
tSEMI (282) 37 59 65 66
|
|
tCOMMA (283) 46 54 63
|
|
tID <str> (284) 16 28 37 47 48 49 55 60 62
|
|
tNB <nbInt> (285) 17 29
|
|
tIF <nbInt> (286) 32 33
|
|
tWHILE <nbInt> (287) 36
|
|
|
|
|
|
Nonterminals, with rules where they appear
|
|
|
|
$accept (33)
|
|
on left: 0
|
|
Program (34)
|
|
on left: 1 2
|
|
on right: 0 2
|
|
Lines (35)
|
|
on left: 3 4
|
|
on right: 4 14
|
|
Line (36)
|
|
on left: 5 6 7 8 9 10 11
|
|
on right: 3 4
|
|
InnerBlock <nbInt> (37)
|
|
on left: 12 14
|
|
on right: 32 33 36 48 49
|
|
$@1 (38)
|
|
on left: 13
|
|
on right: 14
|
|
Condition <addr> (39)
|
|
on left: 15
|
|
on right: 32 33 36
|
|
ConditionalExpression <addr> (40)
|
|
on left: 16 17 18 19 20 21 22 23 24 25 26 27
|
|
on right: 15 18 25 26 27
|
|
NbOrVariable <addr> (41)
|
|
on left: 28 29
|
|
on right: 19 20 21 22 23 24 38
|
|
IfStatement1 <nbInt> (42)
|
|
on left: 30
|
|
on right: 32 33
|
|
IfStatement (43)
|
|
on left: 32 33
|
|
on right: 5
|
|
$@2 (44)
|
|
on left: 31
|
|
on right: 32
|
|
WhileStatement (45)
|
|
on left: 36
|
|
on right: 6
|
|
$@3 (46)
|
|
on left: 34
|
|
on right: 36
|
|
$@4 (47)
|
|
on left: 35
|
|
on right: 36
|
|
Assignment (48)
|
|
on left: 37
|
|
on right: 7
|
|
Expression <addr> (49)
|
|
on left: 38 39 40 41 42 43 44
|
|
on right: 37 40 41 42 43 44 45 46 62 65 66
|
|
Expressions (50)
|
|
on left: 45 46
|
|
on right: 46 47
|
|
FunctionCall (51)
|
|
on left: 47
|
|
on right: 9 39
|
|
FunctionDef (52)
|
|
on left: 48 49
|
|
on right: 1 2
|
|
FunctionParams (53)
|
|
on left: 50 51 52
|
|
on right: 48 49
|
|
VarsWithType (54)
|
|
on left: 53 54
|
|
on right: 52 54
|
|
VarWithType (55)
|
|
on left: 55
|
|
on right: 53 54
|
|
Type <type> (56)
|
|
on left: 56 57
|
|
on right: 48 55 59
|
|
Declarations (57)
|
|
on left: 59
|
|
on right: 8
|
|
$@5 (58)
|
|
on left: 58
|
|
on right: 59
|
|
Declaration <addr> (59)
|
|
on left: 60 62
|
|
on right: 59 63
|
|
$@6 (60)
|
|
on left: 61
|
|
on right: 62
|
|
Declarations1 (61)
|
|
on left: 63 64
|
|
on right: 59 63
|
|
Return (62)
|
|
on left: 65
|
|
on right: 10
|
|
Print (63)
|
|
on left: 66
|
|
on right: 11
|
|
|
|
|
|
State 0
|
|
|
|
0 $accept: • Program $end
|
|
|
|
tFLOAT shift, and go to state 1
|
|
tINT shift, and go to state 2
|
|
tVOID shift, and go to state 3
|
|
|
|
Program go to state 4
|
|
FunctionDef go to state 5
|
|
Type go to state 6
|
|
|
|
|
|
State 1
|
|
|
|
57 Type: tFLOAT •
|
|
|
|
$default reduce using rule 57 (Type)
|
|
|
|
|
|
State 2
|
|
|
|
56 Type: tINT •
|
|
|
|
$default reduce using rule 56 (Type)
|
|
|
|
|
|
State 3
|
|
|
|
49 FunctionDef: tVOID • tID FunctionParams InnerBlock
|
|
|
|
tID shift, and go to state 7
|
|
|
|
|
|
State 4
|
|
|
|
0 $accept: Program • $end
|
|
|
|
$end shift, and go to state 8
|
|
|
|
|
|
State 5
|
|
|
|
1 Program: FunctionDef •
|
|
2 | FunctionDef • Program
|
|
|
|
tFLOAT shift, and go to state 1
|
|
tINT shift, and go to state 2
|
|
tVOID shift, and go to state 3
|
|
|
|
$default reduce using rule 1 (Program)
|
|
|
|
Program go to state 9
|
|
FunctionDef go to state 5
|
|
Type go to state 6
|
|
|
|
|
|
State 6
|
|
|
|
48 FunctionDef: Type • tID FunctionParams InnerBlock
|
|
|
|
tID shift, and go to state 10
|
|
|
|
|
|
State 7
|
|
|
|
49 FunctionDef: tVOID tID • FunctionParams InnerBlock
|
|
|
|
tLPAR shift, and go to state 11
|
|
|
|
FunctionParams go to state 12
|
|
|
|
|
|
State 8
|
|
|
|
0 $accept: Program $end •
|
|
|
|
$default accept
|
|
|
|
|
|
State 9
|
|
|
|
2 Program: FunctionDef Program •
|
|
|
|
$default reduce using rule 2 (Program)
|
|
|
|
|
|
State 10
|
|
|
|
48 FunctionDef: Type tID • FunctionParams InnerBlock
|
|
|
|
tLPAR shift, and go to state 11
|
|
|
|
FunctionParams go to state 13
|
|
|
|
|
|
State 11
|
|
|
|
50 FunctionParams: tLPAR • tRPAR
|
|
51 | tLPAR • tVOID tRPAR
|
|
52 | tLPAR • VarsWithType tRPAR
|
|
|
|
tFLOAT shift, and go to state 1
|
|
tINT shift, and go to state 2
|
|
tVOID shift, and go to state 14
|
|
tRPAR shift, and go to state 15
|
|
|
|
VarsWithType go to state 16
|
|
VarWithType go to state 17
|
|
Type go to state 18
|
|
|
|
|
|
State 12
|
|
|
|
49 FunctionDef: tVOID tID FunctionParams • InnerBlock
|
|
|
|
tLBRACE shift, and go to state 19
|
|
|
|
InnerBlock go to state 20
|
|
|
|
|
|
State 13
|
|
|
|
48 FunctionDef: Type tID FunctionParams • InnerBlock
|
|
|
|
tLBRACE shift, and go to state 19
|
|
|
|
InnerBlock go to state 21
|
|
|
|
|
|
State 14
|
|
|
|
51 FunctionParams: tLPAR tVOID • tRPAR
|
|
|
|
tRPAR shift, and go to state 22
|
|
|
|
|
|
State 15
|
|
|
|
50 FunctionParams: tLPAR tRPAR •
|
|
|
|
$default reduce using rule 50 (FunctionParams)
|
|
|
|
|
|
State 16
|
|
|
|
52 FunctionParams: tLPAR VarsWithType • tRPAR
|
|
|
|
tRPAR shift, and go to state 23
|
|
|
|
|
|
State 17
|
|
|
|
53 VarsWithType: VarWithType •
|
|
54 | VarWithType • tCOMMA VarsWithType
|
|
|
|
tCOMMA shift, and go to state 24
|
|
|
|
$default reduce using rule 53 (VarsWithType)
|
|
|
|
|
|
State 18
|
|
|
|
55 VarWithType: Type • tID
|
|
|
|
tID shift, and go to state 25
|
|
|
|
|
|
State 19
|
|
|
|
12 InnerBlock: tLBRACE • tRBRACE
|
|
14 | tLBRACE • $@1 Lines tRBRACE
|
|
|
|
tRBRACE shift, and go to state 26
|
|
|
|
$default reduce using rule 13 ($@1)
|
|
|
|
$@1 go to state 27
|
|
|
|
|
|
State 20
|
|
|
|
49 FunctionDef: tVOID tID FunctionParams InnerBlock •
|
|
|
|
$default reduce using rule 49 (FunctionDef)
|
|
|
|
|
|
State 21
|
|
|
|
48 FunctionDef: Type tID FunctionParams InnerBlock •
|
|
|
|
$default reduce using rule 48 (FunctionDef)
|
|
|
|
|
|
State 22
|
|
|
|
51 FunctionParams: tLPAR tVOID tRPAR •
|
|
|
|
$default reduce using rule 51 (FunctionParams)
|
|
|
|
|
|
State 23
|
|
|
|
52 FunctionParams: tLPAR VarsWithType tRPAR •
|
|
|
|
$default reduce using rule 52 (FunctionParams)
|
|
|
|
|
|
State 24
|
|
|
|
54 VarsWithType: VarWithType tCOMMA • VarsWithType
|
|
|
|
tFLOAT shift, and go to state 1
|
|
tINT shift, and go to state 2
|
|
|
|
VarsWithType go to state 28
|
|
VarWithType go to state 17
|
|
Type go to state 18
|
|
|
|
|
|
State 25
|
|
|
|
55 VarWithType: Type tID •
|
|
|
|
$default reduce using rule 55 (VarWithType)
|
|
|
|
|
|
State 26
|
|
|
|
12 InnerBlock: tLBRACE tRBRACE •
|
|
|
|
$default reduce using rule 12 (InnerBlock)
|
|
|
|
|
|
State 27
|
|
|
|
14 InnerBlock: tLBRACE $@1 • Lines tRBRACE
|
|
|
|
tRETURN shift, and go to state 29
|
|
tPRINT shift, and go to state 30
|
|
tFLOAT shift, and go to state 1
|
|
tINT shift, and go to state 2
|
|
tID shift, and go to state 31
|
|
tIF shift, and go to state 32
|
|
tWHILE shift, and go to state 33
|
|
|
|
Lines go to state 34
|
|
Line go to state 35
|
|
IfStatement go to state 36
|
|
WhileStatement go to state 37
|
|
Assignment go to state 38
|
|
FunctionCall go to state 39
|
|
Type go to state 40
|
|
Declarations go to state 41
|
|
Return go to state 42
|
|
Print go to state 43
|
|
|
|
|
|
State 28
|
|
|
|
54 VarsWithType: VarWithType tCOMMA VarsWithType •
|
|
|
|
$default reduce using rule 54 (VarsWithType)
|
|
|
|
|
|
State 29
|
|
|
|
65 Return: tRETURN • Expression tSEMI
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 48
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 30
|
|
|
|
66 Print: tPRINT • tLPAR Expression tRPAR tSEMI
|
|
|
|
tLPAR shift, and go to state 50
|
|
|
|
|
|
State 31
|
|
|
|
37 Assignment: tID • tASSIGN Expression tSEMI
|
|
47 FunctionCall: tID • tLPAR Expressions tRPAR
|
|
|
|
tASSIGN shift, and go to state 51
|
|
tLPAR shift, and go to state 52
|
|
|
|
|
|
State 32
|
|
|
|
32 IfStatement: tIF • Condition IfStatement1 InnerBlock tELSE $@2 InnerBlock
|
|
33 | tIF • Condition IfStatement1 InnerBlock
|
|
|
|
tLPAR shift, and go to state 53
|
|
|
|
Condition go to state 54
|
|
|
|
|
|
State 33
|
|
|
|
36 WhileStatement: tWHILE • $@3 Condition $@4 InnerBlock
|
|
|
|
$default reduce using rule 34 ($@3)
|
|
|
|
$@3 go to state 55
|
|
|
|
|
|
State 34
|
|
|
|
14 InnerBlock: tLBRACE $@1 Lines • tRBRACE
|
|
|
|
tRBRACE shift, and go to state 56
|
|
|
|
|
|
State 35
|
|
|
|
3 Lines: Line •
|
|
4 | Line • Lines
|
|
|
|
tRETURN shift, and go to state 29
|
|
tPRINT shift, and go to state 30
|
|
tFLOAT shift, and go to state 1
|
|
tINT shift, and go to state 2
|
|
tID shift, and go to state 31
|
|
tIF shift, and go to state 32
|
|
tWHILE shift, and go to state 33
|
|
|
|
$default reduce using rule 3 (Lines)
|
|
|
|
Lines go to state 57
|
|
Line go to state 35
|
|
IfStatement go to state 36
|
|
WhileStatement go to state 37
|
|
Assignment go to state 38
|
|
FunctionCall go to state 39
|
|
Type go to state 40
|
|
Declarations go to state 41
|
|
Return go to state 42
|
|
Print go to state 43
|
|
|
|
|
|
State 36
|
|
|
|
5 Line: IfStatement •
|
|
|
|
$default reduce using rule 5 (Line)
|
|
|
|
|
|
State 37
|
|
|
|
6 Line: WhileStatement •
|
|
|
|
$default reduce using rule 6 (Line)
|
|
|
|
|
|
State 38
|
|
|
|
7 Line: Assignment •
|
|
|
|
$default reduce using rule 7 (Line)
|
|
|
|
|
|
State 39
|
|
|
|
9 Line: FunctionCall •
|
|
|
|
$default reduce using rule 9 (Line)
|
|
|
|
|
|
State 40
|
|
|
|
59 Declarations: Type • $@5 Declaration Declarations1 tSEMI
|
|
|
|
$default reduce using rule 58 ($@5)
|
|
|
|
$@5 go to state 58
|
|
|
|
|
|
State 41
|
|
|
|
8 Line: Declarations •
|
|
|
|
$default reduce using rule 8 (Line)
|
|
|
|
|
|
State 42
|
|
|
|
10 Line: Return •
|
|
|
|
$default reduce using rule 10 (Line)
|
|
|
|
|
|
State 43
|
|
|
|
11 Line: Print •
|
|
|
|
$default reduce using rule 11 (Line)
|
|
|
|
|
|
State 44
|
|
|
|
40 Expression: tLPAR • Expression tRPAR
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 59
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 45
|
|
|
|
28 NbOrVariable: tID •
|
|
47 FunctionCall: tID • tLPAR Expressions tRPAR
|
|
|
|
tLPAR shift, and go to state 52
|
|
|
|
$default reduce using rule 28 (NbOrVariable)
|
|
|
|
|
|
State 46
|
|
|
|
29 NbOrVariable: tNB •
|
|
|
|
$default reduce using rule 29 (NbOrVariable)
|
|
|
|
|
|
State 47
|
|
|
|
38 Expression: NbOrVariable •
|
|
|
|
$default reduce using rule 38 (Expression)
|
|
|
|
|
|
State 48
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
65 Return: tRETURN Expression • tSEMI
|
|
|
|
tSUB shift, and go to state 60
|
|
tADD shift, and go to state 61
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
tSEMI shift, and go to state 64
|
|
|
|
|
|
State 49
|
|
|
|
39 Expression: FunctionCall •
|
|
|
|
$default reduce using rule 39 (Expression)
|
|
|
|
|
|
State 50
|
|
|
|
66 Print: tPRINT tLPAR • Expression tRPAR tSEMI
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 65
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 51
|
|
|
|
37 Assignment: tID tASSIGN • Expression tSEMI
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 66
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 52
|
|
|
|
47 FunctionCall: tID tLPAR • Expressions tRPAR
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 67
|
|
Expressions go to state 68
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 53
|
|
|
|
15 Condition: tLPAR • ConditionalExpression tRPAR
|
|
|
|
tNOT shift, and go to state 69
|
|
tLPAR shift, and go to state 70
|
|
tID shift, and go to state 71
|
|
tNB shift, and go to state 72
|
|
|
|
ConditionalExpression go to state 73
|
|
NbOrVariable go to state 74
|
|
|
|
|
|
State 54
|
|
|
|
32 IfStatement: tIF Condition • IfStatement1 InnerBlock tELSE $@2 InnerBlock
|
|
33 | tIF Condition • IfStatement1 InnerBlock
|
|
|
|
$default reduce using rule 30 (IfStatement1)
|
|
|
|
IfStatement1 go to state 75
|
|
|
|
|
|
State 55
|
|
|
|
36 WhileStatement: tWHILE $@3 • Condition $@4 InnerBlock
|
|
|
|
tLPAR shift, and go to state 53
|
|
|
|
Condition go to state 76
|
|
|
|
|
|
State 56
|
|
|
|
14 InnerBlock: tLBRACE $@1 Lines tRBRACE •
|
|
|
|
$default reduce using rule 14 (InnerBlock)
|
|
|
|
|
|
State 57
|
|
|
|
4 Lines: Line Lines •
|
|
|
|
$default reduce using rule 4 (Lines)
|
|
|
|
|
|
State 58
|
|
|
|
59 Declarations: Type $@5 • Declaration Declarations1 tSEMI
|
|
|
|
tID shift, and go to state 77
|
|
|
|
Declaration go to state 78
|
|
|
|
|
|
State 59
|
|
|
|
40 Expression: tLPAR Expression • tRPAR
|
|
41 | Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
|
|
tSUB shift, and go to state 60
|
|
tADD shift, and go to state 61
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
tRPAR shift, and go to state 79
|
|
|
|
|
|
State 60
|
|
|
|
42 Expression: Expression tSUB • Expression
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 80
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 61
|
|
|
|
41 Expression: Expression tADD • Expression
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 81
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 62
|
|
|
|
43 Expression: Expression tMUL • Expression
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 82
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 63
|
|
|
|
44 Expression: Expression tDIV • Expression
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 83
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 64
|
|
|
|
65 Return: tRETURN Expression tSEMI •
|
|
|
|
$default reduce using rule 65 (Return)
|
|
|
|
|
|
State 65
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
66 Print: tPRINT tLPAR Expression • tRPAR tSEMI
|
|
|
|
tSUB shift, and go to state 60
|
|
tADD shift, and go to state 61
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
tRPAR shift, and go to state 84
|
|
|
|
|
|
State 66
|
|
|
|
37 Assignment: tID tASSIGN Expression • tSEMI
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
|
|
tSUB shift, and go to state 60
|
|
tADD shift, and go to state 61
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
tSEMI shift, and go to state 85
|
|
|
|
|
|
State 67
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
45 Expressions: Expression •
|
|
46 | Expression • tCOMMA Expressions
|
|
|
|
tSUB shift, and go to state 60
|
|
tADD shift, and go to state 61
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
tCOMMA shift, and go to state 86
|
|
|
|
$default reduce using rule 45 (Expressions)
|
|
|
|
|
|
State 68
|
|
|
|
47 FunctionCall: tID tLPAR Expressions • tRPAR
|
|
|
|
tRPAR shift, and go to state 87
|
|
|
|
|
|
State 69
|
|
|
|
25 ConditionalExpression: tNOT • ConditionalExpression
|
|
|
|
tNOT shift, and go to state 69
|
|
tLPAR shift, and go to state 70
|
|
tID shift, and go to state 71
|
|
tNB shift, and go to state 72
|
|
|
|
ConditionalExpression go to state 88
|
|
NbOrVariable go to state 74
|
|
|
|
|
|
State 70
|
|
|
|
18 ConditionalExpression: tLPAR • ConditionalExpression tRPAR
|
|
|
|
tNOT shift, and go to state 69
|
|
tLPAR shift, and go to state 70
|
|
tID shift, and go to state 71
|
|
tNB shift, and go to state 72
|
|
|
|
ConditionalExpression go to state 89
|
|
NbOrVariable go to state 74
|
|
|
|
|
|
State 71
|
|
|
|
16 ConditionalExpression: tID •
|
|
28 NbOrVariable: tID •
|
|
|
|
tAND reduce using rule 16 (ConditionalExpression)
|
|
tOR reduce using rule 16 (ConditionalExpression)
|
|
tRPAR reduce using rule 16 (ConditionalExpression)
|
|
$default reduce using rule 28 (NbOrVariable)
|
|
|
|
|
|
State 72
|
|
|
|
17 ConditionalExpression: tNB •
|
|
29 NbOrVariable: tNB •
|
|
|
|
tAND reduce using rule 17 (ConditionalExpression)
|
|
tOR reduce using rule 17 (ConditionalExpression)
|
|
tRPAR reduce using rule 17 (ConditionalExpression)
|
|
$default reduce using rule 29 (NbOrVariable)
|
|
|
|
|
|
State 73
|
|
|
|
15 Condition: tLPAR ConditionalExpression • tRPAR
|
|
26 ConditionalExpression: ConditionalExpression • tOR ConditionalExpression
|
|
27 | ConditionalExpression • tAND ConditionalExpression
|
|
|
|
tAND shift, and go to state 90
|
|
tOR shift, and go to state 91
|
|
tRPAR shift, and go to state 92
|
|
|
|
|
|
State 74
|
|
|
|
19 ConditionalExpression: NbOrVariable • tLE NbOrVariable
|
|
20 | NbOrVariable • tGE NbOrVariable
|
|
21 | NbOrVariable • tEQ NbOrVariable
|
|
22 | NbOrVariable • tNE NbOrVariable
|
|
23 | NbOrVariable • tLT NbOrVariable
|
|
24 | NbOrVariable • tGT NbOrVariable
|
|
|
|
tLT shift, and go to state 93
|
|
tGT shift, and go to state 94
|
|
tNE shift, and go to state 95
|
|
tEQ shift, and go to state 96
|
|
tGE shift, and go to state 97
|
|
tLE shift, and go to state 98
|
|
|
|
|
|
State 75
|
|
|
|
32 IfStatement: tIF Condition IfStatement1 • InnerBlock tELSE $@2 InnerBlock
|
|
33 | tIF Condition IfStatement1 • InnerBlock
|
|
|
|
tLBRACE shift, and go to state 19
|
|
|
|
InnerBlock go to state 99
|
|
|
|
|
|
State 76
|
|
|
|
36 WhileStatement: tWHILE $@3 Condition • $@4 InnerBlock
|
|
|
|
$default reduce using rule 35 ($@4)
|
|
|
|
$@4 go to state 100
|
|
|
|
|
|
State 77
|
|
|
|
60 Declaration: tID •
|
|
62 | tID • $@6 tASSIGN Expression
|
|
|
|
tASSIGN reduce using rule 61 ($@6)
|
|
$default reduce using rule 60 (Declaration)
|
|
|
|
$@6 go to state 101
|
|
|
|
|
|
State 78
|
|
|
|
59 Declarations: Type $@5 Declaration • Declarations1 tSEMI
|
|
|
|
tCOMMA shift, and go to state 102
|
|
|
|
$default reduce using rule 64 (Declarations1)
|
|
|
|
Declarations1 go to state 103
|
|
|
|
|
|
State 79
|
|
|
|
40 Expression: tLPAR Expression tRPAR •
|
|
|
|
$default reduce using rule 40 (Expression)
|
|
|
|
|
|
State 80
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
42 | Expression tSUB Expression •
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
|
|
$default reduce using rule 42 (Expression)
|
|
|
|
|
|
State 81
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
41 | Expression tADD Expression •
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
|
|
$default reduce using rule 41 (Expression)
|
|
|
|
|
|
State 82
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
43 | Expression tMUL Expression •
|
|
44 | Expression • tDIV Expression
|
|
|
|
$default reduce using rule 43 (Expression)
|
|
|
|
|
|
State 83
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
44 | Expression tDIV Expression •
|
|
|
|
$default reduce using rule 44 (Expression)
|
|
|
|
|
|
State 84
|
|
|
|
66 Print: tPRINT tLPAR Expression tRPAR • tSEMI
|
|
|
|
tSEMI shift, and go to state 104
|
|
|
|
|
|
State 85
|
|
|
|
37 Assignment: tID tASSIGN Expression tSEMI •
|
|
|
|
$default reduce using rule 37 (Assignment)
|
|
|
|
|
|
State 86
|
|
|
|
46 Expressions: Expression tCOMMA • Expressions
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 67
|
|
Expressions go to state 105
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 87
|
|
|
|
47 FunctionCall: tID tLPAR Expressions tRPAR •
|
|
|
|
$default reduce using rule 47 (FunctionCall)
|
|
|
|
|
|
State 88
|
|
|
|
25 ConditionalExpression: tNOT ConditionalExpression •
|
|
26 | ConditionalExpression • tOR ConditionalExpression
|
|
27 | ConditionalExpression • tAND ConditionalExpression
|
|
|
|
$default reduce using rule 25 (ConditionalExpression)
|
|
|
|
|
|
State 89
|
|
|
|
18 ConditionalExpression: tLPAR ConditionalExpression • tRPAR
|
|
26 | ConditionalExpression • tOR ConditionalExpression
|
|
27 | ConditionalExpression • tAND ConditionalExpression
|
|
|
|
tAND shift, and go to state 90
|
|
tOR shift, and go to state 91
|
|
tRPAR shift, and go to state 106
|
|
|
|
|
|
State 90
|
|
|
|
27 ConditionalExpression: ConditionalExpression tAND • ConditionalExpression
|
|
|
|
tNOT shift, and go to state 69
|
|
tLPAR shift, and go to state 70
|
|
tID shift, and go to state 71
|
|
tNB shift, and go to state 72
|
|
|
|
ConditionalExpression go to state 107
|
|
NbOrVariable go to state 74
|
|
|
|
|
|
State 91
|
|
|
|
26 ConditionalExpression: ConditionalExpression tOR • ConditionalExpression
|
|
|
|
tNOT shift, and go to state 69
|
|
tLPAR shift, and go to state 70
|
|
tID shift, and go to state 71
|
|
tNB shift, and go to state 72
|
|
|
|
ConditionalExpression go to state 108
|
|
NbOrVariable go to state 74
|
|
|
|
|
|
State 92
|
|
|
|
15 Condition: tLPAR ConditionalExpression tRPAR •
|
|
|
|
$default reduce using rule 15 (Condition)
|
|
|
|
|
|
State 93
|
|
|
|
23 ConditionalExpression: NbOrVariable tLT • NbOrVariable
|
|
|
|
tID shift, and go to state 109
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 110
|
|
|
|
|
|
State 94
|
|
|
|
24 ConditionalExpression: NbOrVariable tGT • NbOrVariable
|
|
|
|
tID shift, and go to state 109
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 111
|
|
|
|
|
|
State 95
|
|
|
|
22 ConditionalExpression: NbOrVariable tNE • NbOrVariable
|
|
|
|
tID shift, and go to state 109
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 112
|
|
|
|
|
|
State 96
|
|
|
|
21 ConditionalExpression: NbOrVariable tEQ • NbOrVariable
|
|
|
|
tID shift, and go to state 109
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 113
|
|
|
|
|
|
State 97
|
|
|
|
20 ConditionalExpression: NbOrVariable tGE • NbOrVariable
|
|
|
|
tID shift, and go to state 109
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 114
|
|
|
|
|
|
State 98
|
|
|
|
19 ConditionalExpression: NbOrVariable tLE • NbOrVariable
|
|
|
|
tID shift, and go to state 109
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 115
|
|
|
|
|
|
State 99
|
|
|
|
32 IfStatement: tIF Condition IfStatement1 InnerBlock • tELSE $@2 InnerBlock
|
|
33 | tIF Condition IfStatement1 InnerBlock •
|
|
|
|
tELSE shift, and go to state 116
|
|
|
|
$default reduce using rule 33 (IfStatement)
|
|
|
|
|
|
State 100
|
|
|
|
36 WhileStatement: tWHILE $@3 Condition $@4 • InnerBlock
|
|
|
|
tLBRACE shift, and go to state 19
|
|
|
|
InnerBlock go to state 117
|
|
|
|
|
|
State 101
|
|
|
|
62 Declaration: tID $@6 • tASSIGN Expression
|
|
|
|
tASSIGN shift, and go to state 118
|
|
|
|
|
|
State 102
|
|
|
|
63 Declarations1: tCOMMA • Declaration Declarations1
|
|
|
|
tID shift, and go to state 77
|
|
|
|
Declaration go to state 119
|
|
|
|
|
|
State 103
|
|
|
|
59 Declarations: Type $@5 Declaration Declarations1 • tSEMI
|
|
|
|
tSEMI shift, and go to state 120
|
|
|
|
|
|
State 104
|
|
|
|
66 Print: tPRINT tLPAR Expression tRPAR tSEMI •
|
|
|
|
$default reduce using rule 66 (Print)
|
|
|
|
|
|
State 105
|
|
|
|
46 Expressions: Expression tCOMMA Expressions •
|
|
|
|
$default reduce using rule 46 (Expressions)
|
|
|
|
|
|
State 106
|
|
|
|
18 ConditionalExpression: tLPAR ConditionalExpression tRPAR •
|
|
|
|
$default reduce using rule 18 (ConditionalExpression)
|
|
|
|
|
|
State 107
|
|
|
|
26 ConditionalExpression: ConditionalExpression • tOR ConditionalExpression
|
|
27 | ConditionalExpression • tAND ConditionalExpression
|
|
27 | ConditionalExpression tAND ConditionalExpression •
|
|
|
|
$default reduce using rule 27 (ConditionalExpression)
|
|
|
|
|
|
State 108
|
|
|
|
26 ConditionalExpression: ConditionalExpression • tOR ConditionalExpression
|
|
26 | ConditionalExpression tOR ConditionalExpression •
|
|
27 | ConditionalExpression • tAND ConditionalExpression
|
|
|
|
$default reduce using rule 26 (ConditionalExpression)
|
|
|
|
|
|
State 109
|
|
|
|
28 NbOrVariable: tID •
|
|
|
|
$default reduce using rule 28 (NbOrVariable)
|
|
|
|
|
|
State 110
|
|
|
|
23 ConditionalExpression: NbOrVariable tLT NbOrVariable •
|
|
|
|
$default reduce using rule 23 (ConditionalExpression)
|
|
|
|
|
|
State 111
|
|
|
|
24 ConditionalExpression: NbOrVariable tGT NbOrVariable •
|
|
|
|
$default reduce using rule 24 (ConditionalExpression)
|
|
|
|
|
|
State 112
|
|
|
|
22 ConditionalExpression: NbOrVariable tNE NbOrVariable •
|
|
|
|
$default reduce using rule 22 (ConditionalExpression)
|
|
|
|
|
|
State 113
|
|
|
|
21 ConditionalExpression: NbOrVariable tEQ NbOrVariable •
|
|
|
|
$default reduce using rule 21 (ConditionalExpression)
|
|
|
|
|
|
State 114
|
|
|
|
20 ConditionalExpression: NbOrVariable tGE NbOrVariable •
|
|
|
|
$default reduce using rule 20 (ConditionalExpression)
|
|
|
|
|
|
State 115
|
|
|
|
19 ConditionalExpression: NbOrVariable tLE NbOrVariable •
|
|
|
|
$default reduce using rule 19 (ConditionalExpression)
|
|
|
|
|
|
State 116
|
|
|
|
32 IfStatement: tIF Condition IfStatement1 InnerBlock tELSE • $@2 InnerBlock
|
|
|
|
$default reduce using rule 31 ($@2)
|
|
|
|
$@2 go to state 121
|
|
|
|
|
|
State 117
|
|
|
|
36 WhileStatement: tWHILE $@3 Condition $@4 InnerBlock •
|
|
|
|
$default reduce using rule 36 (WhileStatement)
|
|
|
|
|
|
State 118
|
|
|
|
62 Declaration: tID $@6 tASSIGN • Expression
|
|
|
|
tLPAR shift, and go to state 44
|
|
tID shift, and go to state 45
|
|
tNB shift, and go to state 46
|
|
|
|
NbOrVariable go to state 47
|
|
Expression go to state 122
|
|
FunctionCall go to state 49
|
|
|
|
|
|
State 119
|
|
|
|
63 Declarations1: tCOMMA Declaration • Declarations1
|
|
|
|
tCOMMA shift, and go to state 102
|
|
|
|
$default reduce using rule 64 (Declarations1)
|
|
|
|
Declarations1 go to state 123
|
|
|
|
|
|
State 120
|
|
|
|
59 Declarations: Type $@5 Declaration Declarations1 tSEMI •
|
|
|
|
$default reduce using rule 59 (Declarations)
|
|
|
|
|
|
State 121
|
|
|
|
32 IfStatement: tIF Condition IfStatement1 InnerBlock tELSE $@2 • InnerBlock
|
|
|
|
tLBRACE shift, and go to state 19
|
|
|
|
InnerBlock go to state 124
|
|
|
|
|
|
State 122
|
|
|
|
41 Expression: Expression • tADD Expression
|
|
42 | Expression • tSUB Expression
|
|
43 | Expression • tMUL Expression
|
|
44 | Expression • tDIV Expression
|
|
62 Declaration: tID $@6 tASSIGN Expression •
|
|
|
|
tSUB shift, and go to state 60
|
|
tADD shift, and go to state 61
|
|
tMUL shift, and go to state 62
|
|
tDIV shift, and go to state 63
|
|
|
|
$default reduce using rule 62 (Declaration)
|
|
|
|
|
|
State 123
|
|
|
|
63 Declarations1: tCOMMA Declaration Declarations1 •
|
|
|
|
$default reduce using rule 63 (Declarations1)
|
|
|
|
|
|
State 124
|
|
|
|
32 IfStatement: tIF Condition IfStatement1 InnerBlock tELSE $@2 InnerBlock •
|
|
|
|
$default reduce using rule 32 (IfStatement)
|