-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.out
3220 lines (2667 loc) · 119 KB
/
parser.out
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Created by PLY version 3.11 (http://www.dabeaz.com/ply)
Unused terminals:
COMMENT
Grammar
Rule 0 S' -> Start
Rule 1 Start -> Program
Rule 2 Program -> Program GlobalDecl
Rule 3 Program -> <empty>
Rule 4 GlobalDecl -> FuncDecl
Rule 5 GlobalDecl -> VarDecl SEMI
Rule 6 FuncDecl -> FuncHead FuncBody
Rule 7 FuncHead -> Type FuncName LPAREN newScope Args RPAREN
Rule 8 FuncBody -> LBRACE Stmts RBRACE
Rule 9 newScope -> <empty>
Rule 10 FuncName -> ID
Rule 11 Args -> Arg
Rule 12 Args -> <empty>
Rule 13 Type -> INT
Rule 14 Type -> CHAR
Rule 15 Type -> VOID
Rule 16 Arg -> Type ID
Rule 17 Arg -> Arg COMMA Type ID
Rule 18 VarDeclStmt -> VarDecl SEMI
Rule 19 VarDecl -> Type ID
Rule 20 VarDecl -> VarDecl COMMA ID
Rule 21 Stmts -> Stmts Stmt
Rule 22 Stmts -> <empty>
Rule 23 Stmt -> AssignStmt
Rule 24 Stmt -> PrintStmt
Rule 25 Stmt -> CallStmt
Rule 26 Stmt -> ReturnStmt
Rule 27 Stmt -> IfStmt
Rule 28 Stmt -> WhileStmt
Rule 29 Stmt -> BreakStmt
Rule 30 Stmt -> ContinueStmt
Rule 31 Stmt -> VarDeclStmt
Rule 32 AssignStmt -> ID ASSIGN Expr SEMI
Rule 33 PrintStmt -> PRINT LPAREN Actuals RPAREN SEMI
Rule 34 PActuals -> PActuals COMMA Expr
Rule 35 PActuals -> <empty>
Rule 36 CallStmt -> CallExpr SEMI
Rule 37 CallExpr -> ID LPAREN Actuals RPAREN
Rule 38 Actuals -> Expr PActuals
Rule 39 Actuals -> <empty>
Rule 40 ReturnStmt -> RETURN Expr SEMI
Rule 41 ReturnStmt -> RETURN SEMI
Rule 42 IfStmt -> If TestExpr Then StmtsBlock EndThen EndIf
Rule 43 IfStmt -> If TestExpr Then StmtsBlock EndThen Else StmtsBlock EndIf
Rule 44 TestExpr -> LPAREN Expr RPAREN
Rule 45 StmtsBlock -> LBRACE newScope Stmts RBRACE
Rule 46 If -> IF
Rule 47 Else -> ELSE
Rule 48 Then -> <empty>
Rule 49 EndThen -> <empty>
Rule 50 EndIf -> <empty>
Rule 51 WhileStmt -> While TestExpr Do StmtsBlock EndWhile
Rule 52 While -> WHILE
Rule 53 Do -> <empty>
Rule 54 EndWhile -> <empty>
Rule 55 BreakStmt -> BREAK SEMI
Rule 56 ContinueStmt -> CONTINUE SEMI
Rule 57 Expr -> Expr PLUS Expr
Rule 58 Expr -> Expr MINUS Expr
Rule 59 Expr -> Expr TIMES Expr
Rule 60 Expr -> Expr DIVIDE Expr
Rule 61 Expr -> Expr LSHIFT Expr
Rule 62 Expr -> Expr RSHIFT Expr
Rule 63 Expr -> Expr LT Expr
Rule 64 Expr -> Expr GT Expr
Rule 65 Expr -> Expr EQ Expr
Rule 66 Expr -> Expr NE Expr
Rule 67 Expr -> Expr LE Expr
Rule 68 Expr -> Expr GE Expr
Rule 69 Expr -> Expr OR Expr
Rule 70 Expr -> Expr AND Expr
Rule 71 Expr -> NOT Expr
Rule 72 Expr -> MINUS Expr
Rule 73 Expr -> NUMBER
Rule 74 Expr -> LPAREN Expr RPAREN
Rule 75 Expr -> CallExpr
Rule 76 Expr -> ID
Terminals, with rules where they appear
AND : 70
ASSIGN : 32
BREAK : 55
CHAR : 14
COMMA : 17 20 34
COMMENT :
CONTINUE : 56
DIVIDE : 60
ELSE : 47
EQ : 65
GE : 68
GT : 64
ID : 10 16 17 19 20 32 37 76
IF : 46
INT : 13
LBRACE : 8 45
LE : 67
LPAREN : 7 33 37 44 74
LSHIFT : 61
LT : 63
MINUS : 58 72
NE : 66
NOT : 71
NUMBER : 73
OR : 69
PLUS : 57
PRINT : 33
RBRACE : 8 45
RETURN : 40 41
RPAREN : 7 33 37 44 74
RSHIFT : 62
SEMI : 5 18 32 33 36 40 41 55 56
TIMES : 59
VOID : 15
WHILE : 52
error :
Nonterminals, with rules where they appear
Actuals : 33 37
Arg : 11 17
Args : 7
AssignStmt : 23
BreakStmt : 29
CallExpr : 36 75
CallStmt : 25
ContinueStmt : 30
Do : 51
Else : 43
EndIf : 42 43
EndThen : 42 43
EndWhile : 51
Expr : 32 34 38 40 44 57 57 58 58 59 59 60 60 61 61 62 62 63 63 64 64 65 65 66 66 67 67 68 68 69 69 70 70 71 72 74
FuncBody : 6
FuncDecl : 4
FuncHead : 6
FuncName : 7
GlobalDecl : 2
If : 42 43
IfStmt : 27
PActuals : 34 38
PrintStmt : 24
Program : 1 2
ReturnStmt : 26
Start : 0
Stmt : 21
Stmts : 8 21 45
StmtsBlock : 42 43 43 51
TestExpr : 42 43 51
Then : 42 43
Type : 7 16 17 19
VarDecl : 5 18 20
VarDeclStmt : 31
While : 51
WhileStmt : 28
newScope : 7 45
Parsing method: LALR
state 0
(0) S' -> . Start
(1) Start -> . Program
(2) Program -> . Program GlobalDecl
(3) Program -> .
INT reduce using rule 3 (Program -> .)
CHAR reduce using rule 3 (Program -> .)
VOID reduce using rule 3 (Program -> .)
$end reduce using rule 3 (Program -> .)
Start shift and go to state 1
Program shift and go to state 2
state 1
(0) S' -> Start .
state 2
(1) Start -> Program .
(2) Program -> Program . GlobalDecl
(4) GlobalDecl -> . FuncDecl
(5) GlobalDecl -> . VarDecl SEMI
(6) FuncDecl -> . FuncHead FuncBody
(19) VarDecl -> . Type ID
(20) VarDecl -> . VarDecl COMMA ID
(7) FuncHead -> . Type FuncName LPAREN newScope Args RPAREN
(13) Type -> . INT
(14) Type -> . CHAR
(15) Type -> . VOID
$end reduce using rule 1 (Start -> Program .)
INT shift and go to state 8
CHAR shift and go to state 9
VOID shift and go to state 10
GlobalDecl shift and go to state 3
FuncDecl shift and go to state 4
VarDecl shift and go to state 5
FuncHead shift and go to state 6
Type shift and go to state 7
state 3
(2) Program -> Program GlobalDecl .
INT reduce using rule 2 (Program -> Program GlobalDecl .)
CHAR reduce using rule 2 (Program -> Program GlobalDecl .)
VOID reduce using rule 2 (Program -> Program GlobalDecl .)
$end reduce using rule 2 (Program -> Program GlobalDecl .)
state 4
(4) GlobalDecl -> FuncDecl .
INT reduce using rule 4 (GlobalDecl -> FuncDecl .)
CHAR reduce using rule 4 (GlobalDecl -> FuncDecl .)
VOID reduce using rule 4 (GlobalDecl -> FuncDecl .)
$end reduce using rule 4 (GlobalDecl -> FuncDecl .)
state 5
(5) GlobalDecl -> VarDecl . SEMI
(20) VarDecl -> VarDecl . COMMA ID
SEMI shift and go to state 11
COMMA shift and go to state 12
state 6
(6) FuncDecl -> FuncHead . FuncBody
(8) FuncBody -> . LBRACE Stmts RBRACE
LBRACE shift and go to state 14
FuncBody shift and go to state 13
state 7
(19) VarDecl -> Type . ID
(7) FuncHead -> Type . FuncName LPAREN newScope Args RPAREN
(10) FuncName -> . ID
ID shift and go to state 15
FuncName shift and go to state 16
state 8
(13) Type -> INT .
ID reduce using rule 13 (Type -> INT .)
state 9
(14) Type -> CHAR .
ID reduce using rule 14 (Type -> CHAR .)
state 10
(15) Type -> VOID .
ID reduce using rule 15 (Type -> VOID .)
state 11
(5) GlobalDecl -> VarDecl SEMI .
INT reduce using rule 5 (GlobalDecl -> VarDecl SEMI .)
CHAR reduce using rule 5 (GlobalDecl -> VarDecl SEMI .)
VOID reduce using rule 5 (GlobalDecl -> VarDecl SEMI .)
$end reduce using rule 5 (GlobalDecl -> VarDecl SEMI .)
state 12
(20) VarDecl -> VarDecl COMMA . ID
ID shift and go to state 17
state 13
(6) FuncDecl -> FuncHead FuncBody .
INT reduce using rule 6 (FuncDecl -> FuncHead FuncBody .)
CHAR reduce using rule 6 (FuncDecl -> FuncHead FuncBody .)
VOID reduce using rule 6 (FuncDecl -> FuncHead FuncBody .)
$end reduce using rule 6 (FuncDecl -> FuncHead FuncBody .)
state 14
(8) FuncBody -> LBRACE . Stmts RBRACE
(21) Stmts -> . Stmts Stmt
(22) Stmts -> .
RBRACE reduce using rule 22 (Stmts -> .)
ID reduce using rule 22 (Stmts -> .)
PRINT reduce using rule 22 (Stmts -> .)
RETURN reduce using rule 22 (Stmts -> .)
BREAK reduce using rule 22 (Stmts -> .)
CONTINUE reduce using rule 22 (Stmts -> .)
IF reduce using rule 22 (Stmts -> .)
WHILE reduce using rule 22 (Stmts -> .)
INT reduce using rule 22 (Stmts -> .)
CHAR reduce using rule 22 (Stmts -> .)
VOID reduce using rule 22 (Stmts -> .)
Stmts shift and go to state 18
state 15
(19) VarDecl -> Type ID .
(10) FuncName -> ID .
SEMI reduce using rule 19 (VarDecl -> Type ID .)
COMMA reduce using rule 19 (VarDecl -> Type ID .)
LPAREN reduce using rule 10 (FuncName -> ID .)
state 16
(7) FuncHead -> Type FuncName . LPAREN newScope Args RPAREN
LPAREN shift and go to state 19
state 17
(20) VarDecl -> VarDecl COMMA ID .
SEMI reduce using rule 20 (VarDecl -> VarDecl COMMA ID .)
COMMA reduce using rule 20 (VarDecl -> VarDecl COMMA ID .)
state 18
(8) FuncBody -> LBRACE Stmts . RBRACE
(21) Stmts -> Stmts . Stmt
(23) Stmt -> . AssignStmt
(24) Stmt -> . PrintStmt
(25) Stmt -> . CallStmt
(26) Stmt -> . ReturnStmt
(27) Stmt -> . IfStmt
(28) Stmt -> . WhileStmt
(29) Stmt -> . BreakStmt
(30) Stmt -> . ContinueStmt
(31) Stmt -> . VarDeclStmt
(32) AssignStmt -> . ID ASSIGN Expr SEMI
(33) PrintStmt -> . PRINT LPAREN Actuals RPAREN SEMI
(36) CallStmt -> . CallExpr SEMI
(40) ReturnStmt -> . RETURN Expr SEMI
(41) ReturnStmt -> . RETURN SEMI
(42) IfStmt -> . If TestExpr Then StmtsBlock EndThen EndIf
(43) IfStmt -> . If TestExpr Then StmtsBlock EndThen Else StmtsBlock EndIf
(51) WhileStmt -> . While TestExpr Do StmtsBlock EndWhile
(55) BreakStmt -> . BREAK SEMI
(56) ContinueStmt -> . CONTINUE SEMI
(18) VarDeclStmt -> . VarDecl SEMI
(37) CallExpr -> . ID LPAREN Actuals RPAREN
(46) If -> . IF
(52) While -> . WHILE
(19) VarDecl -> . Type ID
(20) VarDecl -> . VarDecl COMMA ID
(13) Type -> . INT
(14) Type -> . CHAR
(15) Type -> . VOID
RBRACE shift and go to state 20
ID shift and go to state 31
PRINT shift and go to state 32
RETURN shift and go to state 34
BREAK shift and go to state 37
CONTINUE shift and go to state 38
IF shift and go to state 40
WHILE shift and go to state 41
INT shift and go to state 8
CHAR shift and go to state 9
VOID shift and go to state 10
Stmt shift and go to state 21
AssignStmt shift and go to state 22
PrintStmt shift and go to state 23
CallStmt shift and go to state 24
ReturnStmt shift and go to state 25
IfStmt shift and go to state 26
WhileStmt shift and go to state 27
BreakStmt shift and go to state 28
ContinueStmt shift and go to state 29
VarDeclStmt shift and go to state 30
CallExpr shift and go to state 33
If shift and go to state 35
While shift and go to state 36
VarDecl shift and go to state 39
Type shift and go to state 42
state 19
(7) FuncHead -> Type FuncName LPAREN . newScope Args RPAREN
(9) newScope -> .
INT reduce using rule 9 (newScope -> .)
CHAR reduce using rule 9 (newScope -> .)
VOID reduce using rule 9 (newScope -> .)
RPAREN reduce using rule 9 (newScope -> .)
newScope shift and go to state 43
state 20
(8) FuncBody -> LBRACE Stmts RBRACE .
INT reduce using rule 8 (FuncBody -> LBRACE Stmts RBRACE .)
CHAR reduce using rule 8 (FuncBody -> LBRACE Stmts RBRACE .)
VOID reduce using rule 8 (FuncBody -> LBRACE Stmts RBRACE .)
$end reduce using rule 8 (FuncBody -> LBRACE Stmts RBRACE .)
state 21
(21) Stmts -> Stmts Stmt .
RBRACE reduce using rule 21 (Stmts -> Stmts Stmt .)
ID reduce using rule 21 (Stmts -> Stmts Stmt .)
PRINT reduce using rule 21 (Stmts -> Stmts Stmt .)
RETURN reduce using rule 21 (Stmts -> Stmts Stmt .)
BREAK reduce using rule 21 (Stmts -> Stmts Stmt .)
CONTINUE reduce using rule 21 (Stmts -> Stmts Stmt .)
IF reduce using rule 21 (Stmts -> Stmts Stmt .)
WHILE reduce using rule 21 (Stmts -> Stmts Stmt .)
INT reduce using rule 21 (Stmts -> Stmts Stmt .)
CHAR reduce using rule 21 (Stmts -> Stmts Stmt .)
VOID reduce using rule 21 (Stmts -> Stmts Stmt .)
state 22
(23) Stmt -> AssignStmt .
RBRACE reduce using rule 23 (Stmt -> AssignStmt .)
ID reduce using rule 23 (Stmt -> AssignStmt .)
PRINT reduce using rule 23 (Stmt -> AssignStmt .)
RETURN reduce using rule 23 (Stmt -> AssignStmt .)
BREAK reduce using rule 23 (Stmt -> AssignStmt .)
CONTINUE reduce using rule 23 (Stmt -> AssignStmt .)
IF reduce using rule 23 (Stmt -> AssignStmt .)
WHILE reduce using rule 23 (Stmt -> AssignStmt .)
INT reduce using rule 23 (Stmt -> AssignStmt .)
CHAR reduce using rule 23 (Stmt -> AssignStmt .)
VOID reduce using rule 23 (Stmt -> AssignStmt .)
state 23
(24) Stmt -> PrintStmt .
RBRACE reduce using rule 24 (Stmt -> PrintStmt .)
ID reduce using rule 24 (Stmt -> PrintStmt .)
PRINT reduce using rule 24 (Stmt -> PrintStmt .)
RETURN reduce using rule 24 (Stmt -> PrintStmt .)
BREAK reduce using rule 24 (Stmt -> PrintStmt .)
CONTINUE reduce using rule 24 (Stmt -> PrintStmt .)
IF reduce using rule 24 (Stmt -> PrintStmt .)
WHILE reduce using rule 24 (Stmt -> PrintStmt .)
INT reduce using rule 24 (Stmt -> PrintStmt .)
CHAR reduce using rule 24 (Stmt -> PrintStmt .)
VOID reduce using rule 24 (Stmt -> PrintStmt .)
state 24
(25) Stmt -> CallStmt .
RBRACE reduce using rule 25 (Stmt -> CallStmt .)
ID reduce using rule 25 (Stmt -> CallStmt .)
PRINT reduce using rule 25 (Stmt -> CallStmt .)
RETURN reduce using rule 25 (Stmt -> CallStmt .)
BREAK reduce using rule 25 (Stmt -> CallStmt .)
CONTINUE reduce using rule 25 (Stmt -> CallStmt .)
IF reduce using rule 25 (Stmt -> CallStmt .)
WHILE reduce using rule 25 (Stmt -> CallStmt .)
INT reduce using rule 25 (Stmt -> CallStmt .)
CHAR reduce using rule 25 (Stmt -> CallStmt .)
VOID reduce using rule 25 (Stmt -> CallStmt .)
state 25
(26) Stmt -> ReturnStmt .
RBRACE reduce using rule 26 (Stmt -> ReturnStmt .)
ID reduce using rule 26 (Stmt -> ReturnStmt .)
PRINT reduce using rule 26 (Stmt -> ReturnStmt .)
RETURN reduce using rule 26 (Stmt -> ReturnStmt .)
BREAK reduce using rule 26 (Stmt -> ReturnStmt .)
CONTINUE reduce using rule 26 (Stmt -> ReturnStmt .)
IF reduce using rule 26 (Stmt -> ReturnStmt .)
WHILE reduce using rule 26 (Stmt -> ReturnStmt .)
INT reduce using rule 26 (Stmt -> ReturnStmt .)
CHAR reduce using rule 26 (Stmt -> ReturnStmt .)
VOID reduce using rule 26 (Stmt -> ReturnStmt .)
state 26
(27) Stmt -> IfStmt .
RBRACE reduce using rule 27 (Stmt -> IfStmt .)
ID reduce using rule 27 (Stmt -> IfStmt .)
PRINT reduce using rule 27 (Stmt -> IfStmt .)
RETURN reduce using rule 27 (Stmt -> IfStmt .)
BREAK reduce using rule 27 (Stmt -> IfStmt .)
CONTINUE reduce using rule 27 (Stmt -> IfStmt .)
IF reduce using rule 27 (Stmt -> IfStmt .)
WHILE reduce using rule 27 (Stmt -> IfStmt .)
INT reduce using rule 27 (Stmt -> IfStmt .)
CHAR reduce using rule 27 (Stmt -> IfStmt .)
VOID reduce using rule 27 (Stmt -> IfStmt .)
state 27
(28) Stmt -> WhileStmt .
RBRACE reduce using rule 28 (Stmt -> WhileStmt .)
ID reduce using rule 28 (Stmt -> WhileStmt .)
PRINT reduce using rule 28 (Stmt -> WhileStmt .)
RETURN reduce using rule 28 (Stmt -> WhileStmt .)
BREAK reduce using rule 28 (Stmt -> WhileStmt .)
CONTINUE reduce using rule 28 (Stmt -> WhileStmt .)
IF reduce using rule 28 (Stmt -> WhileStmt .)
WHILE reduce using rule 28 (Stmt -> WhileStmt .)
INT reduce using rule 28 (Stmt -> WhileStmt .)
CHAR reduce using rule 28 (Stmt -> WhileStmt .)
VOID reduce using rule 28 (Stmt -> WhileStmt .)
state 28
(29) Stmt -> BreakStmt .
RBRACE reduce using rule 29 (Stmt -> BreakStmt .)
ID reduce using rule 29 (Stmt -> BreakStmt .)
PRINT reduce using rule 29 (Stmt -> BreakStmt .)
RETURN reduce using rule 29 (Stmt -> BreakStmt .)
BREAK reduce using rule 29 (Stmt -> BreakStmt .)
CONTINUE reduce using rule 29 (Stmt -> BreakStmt .)
IF reduce using rule 29 (Stmt -> BreakStmt .)
WHILE reduce using rule 29 (Stmt -> BreakStmt .)
INT reduce using rule 29 (Stmt -> BreakStmt .)
CHAR reduce using rule 29 (Stmt -> BreakStmt .)
VOID reduce using rule 29 (Stmt -> BreakStmt .)
state 29
(30) Stmt -> ContinueStmt .
RBRACE reduce using rule 30 (Stmt -> ContinueStmt .)
ID reduce using rule 30 (Stmt -> ContinueStmt .)
PRINT reduce using rule 30 (Stmt -> ContinueStmt .)
RETURN reduce using rule 30 (Stmt -> ContinueStmt .)
BREAK reduce using rule 30 (Stmt -> ContinueStmt .)
CONTINUE reduce using rule 30 (Stmt -> ContinueStmt .)
IF reduce using rule 30 (Stmt -> ContinueStmt .)
WHILE reduce using rule 30 (Stmt -> ContinueStmt .)
INT reduce using rule 30 (Stmt -> ContinueStmt .)
CHAR reduce using rule 30 (Stmt -> ContinueStmt .)
VOID reduce using rule 30 (Stmt -> ContinueStmt .)
state 30
(31) Stmt -> VarDeclStmt .
RBRACE reduce using rule 31 (Stmt -> VarDeclStmt .)
ID reduce using rule 31 (Stmt -> VarDeclStmt .)
PRINT reduce using rule 31 (Stmt -> VarDeclStmt .)
RETURN reduce using rule 31 (Stmt -> VarDeclStmt .)
BREAK reduce using rule 31 (Stmt -> VarDeclStmt .)
CONTINUE reduce using rule 31 (Stmt -> VarDeclStmt .)
IF reduce using rule 31 (Stmt -> VarDeclStmt .)
WHILE reduce using rule 31 (Stmt -> VarDeclStmt .)
INT reduce using rule 31 (Stmt -> VarDeclStmt .)
CHAR reduce using rule 31 (Stmt -> VarDeclStmt .)
VOID reduce using rule 31 (Stmt -> VarDeclStmt .)
state 31
(32) AssignStmt -> ID . ASSIGN Expr SEMI
(37) CallExpr -> ID . LPAREN Actuals RPAREN
ASSIGN shift and go to state 44
LPAREN shift and go to state 45
state 32
(33) PrintStmt -> PRINT . LPAREN Actuals RPAREN SEMI
LPAREN shift and go to state 46
state 33
(36) CallStmt -> CallExpr . SEMI
SEMI shift and go to state 47
state 34
(40) ReturnStmt -> RETURN . Expr SEMI
(41) ReturnStmt -> RETURN . SEMI
(57) Expr -> . Expr PLUS Expr
(58) Expr -> . Expr MINUS Expr
(59) Expr -> . Expr TIMES Expr
(60) Expr -> . Expr DIVIDE Expr
(61) Expr -> . Expr LSHIFT Expr
(62) Expr -> . Expr RSHIFT Expr
(63) Expr -> . Expr LT Expr
(64) Expr -> . Expr GT Expr
(65) Expr -> . Expr EQ Expr
(66) Expr -> . Expr NE Expr
(67) Expr -> . Expr LE Expr
(68) Expr -> . Expr GE Expr
(69) Expr -> . Expr OR Expr
(70) Expr -> . Expr AND Expr
(71) Expr -> . NOT Expr
(72) Expr -> . MINUS Expr
(73) Expr -> . NUMBER
(74) Expr -> . LPAREN Expr RPAREN
(75) Expr -> . CallExpr
(76) Expr -> . ID
(37) CallExpr -> . ID LPAREN Actuals RPAREN
SEMI shift and go to state 49
NOT shift and go to state 51
MINUS shift and go to state 50
NUMBER shift and go to state 52
LPAREN shift and go to state 53
ID shift and go to state 55
Expr shift and go to state 48
CallExpr shift and go to state 54
state 35
(42) IfStmt -> If . TestExpr Then StmtsBlock EndThen EndIf
(43) IfStmt -> If . TestExpr Then StmtsBlock EndThen Else StmtsBlock EndIf
(44) TestExpr -> . LPAREN Expr RPAREN
LPAREN shift and go to state 57
TestExpr shift and go to state 56
state 36
(51) WhileStmt -> While . TestExpr Do StmtsBlock EndWhile
(44) TestExpr -> . LPAREN Expr RPAREN
LPAREN shift and go to state 57
TestExpr shift and go to state 58
state 37
(55) BreakStmt -> BREAK . SEMI
SEMI shift and go to state 59
state 38
(56) ContinueStmt -> CONTINUE . SEMI
SEMI shift and go to state 60
state 39
(18) VarDeclStmt -> VarDecl . SEMI
(20) VarDecl -> VarDecl . COMMA ID
SEMI shift and go to state 61
COMMA shift and go to state 12
state 40
(46) If -> IF .
LPAREN reduce using rule 46 (If -> IF .)
state 41
(52) While -> WHILE .
LPAREN reduce using rule 52 (While -> WHILE .)
state 42
(19) VarDecl -> Type . ID
ID shift and go to state 62
state 43
(7) FuncHead -> Type FuncName LPAREN newScope . Args RPAREN
(11) Args -> . Arg
(12) Args -> .
(16) Arg -> . Type ID
(17) Arg -> . Arg COMMA Type ID
(13) Type -> . INT
(14) Type -> . CHAR
(15) Type -> . VOID
RPAREN reduce using rule 12 (Args -> .)
INT shift and go to state 8
CHAR shift and go to state 9
VOID shift and go to state 10
Type shift and go to state 63
Args shift and go to state 64
Arg shift and go to state 65
state 44
(32) AssignStmt -> ID ASSIGN . Expr SEMI
(57) Expr -> . Expr PLUS Expr
(58) Expr -> . Expr MINUS Expr
(59) Expr -> . Expr TIMES Expr
(60) Expr -> . Expr DIVIDE Expr
(61) Expr -> . Expr LSHIFT Expr
(62) Expr -> . Expr RSHIFT Expr
(63) Expr -> . Expr LT Expr
(64) Expr -> . Expr GT Expr
(65) Expr -> . Expr EQ Expr
(66) Expr -> . Expr NE Expr
(67) Expr -> . Expr LE Expr
(68) Expr -> . Expr GE Expr
(69) Expr -> . Expr OR Expr
(70) Expr -> . Expr AND Expr
(71) Expr -> . NOT Expr
(72) Expr -> . MINUS Expr
(73) Expr -> . NUMBER
(74) Expr -> . LPAREN Expr RPAREN
(75) Expr -> . CallExpr
(76) Expr -> . ID
(37) CallExpr -> . ID LPAREN Actuals RPAREN
NOT shift and go to state 51
MINUS shift and go to state 50
NUMBER shift and go to state 52
LPAREN shift and go to state 53
ID shift and go to state 55
Expr shift and go to state 66
CallExpr shift and go to state 54
state 45
(37) CallExpr -> ID LPAREN . Actuals RPAREN
(38) Actuals -> . Expr PActuals
(39) Actuals -> .
(57) Expr -> . Expr PLUS Expr
(58) Expr -> . Expr MINUS Expr
(59) Expr -> . Expr TIMES Expr
(60) Expr -> . Expr DIVIDE Expr
(61) Expr -> . Expr LSHIFT Expr
(62) Expr -> . Expr RSHIFT Expr
(63) Expr -> . Expr LT Expr
(64) Expr -> . Expr GT Expr
(65) Expr -> . Expr EQ Expr
(66) Expr -> . Expr NE Expr
(67) Expr -> . Expr LE Expr
(68) Expr -> . Expr GE Expr
(69) Expr -> . Expr OR Expr
(70) Expr -> . Expr AND Expr
(71) Expr -> . NOT Expr
(72) Expr -> . MINUS Expr
(73) Expr -> . NUMBER
(74) Expr -> . LPAREN Expr RPAREN
(75) Expr -> . CallExpr
(76) Expr -> . ID
(37) CallExpr -> . ID LPAREN Actuals RPAREN
RPAREN reduce using rule 39 (Actuals -> .)
NOT shift and go to state 51
MINUS shift and go to state 50
NUMBER shift and go to state 52
LPAREN shift and go to state 53
ID shift and go to state 55
Actuals shift and go to state 67
Expr shift and go to state 68
CallExpr shift and go to state 54
state 46
(33) PrintStmt -> PRINT LPAREN . Actuals RPAREN SEMI
(38) Actuals -> . Expr PActuals
(39) Actuals -> .
(57) Expr -> . Expr PLUS Expr
(58) Expr -> . Expr MINUS Expr
(59) Expr -> . Expr TIMES Expr
(60) Expr -> . Expr DIVIDE Expr
(61) Expr -> . Expr LSHIFT Expr
(62) Expr -> . Expr RSHIFT Expr
(63) Expr -> . Expr LT Expr
(64) Expr -> . Expr GT Expr
(65) Expr -> . Expr EQ Expr
(66) Expr -> . Expr NE Expr
(67) Expr -> . Expr LE Expr
(68) Expr -> . Expr GE Expr
(69) Expr -> . Expr OR Expr
(70) Expr -> . Expr AND Expr
(71) Expr -> . NOT Expr
(72) Expr -> . MINUS Expr
(73) Expr -> . NUMBER
(74) Expr -> . LPAREN Expr RPAREN
(75) Expr -> . CallExpr
(76) Expr -> . ID
(37) CallExpr -> . ID LPAREN Actuals RPAREN
RPAREN reduce using rule 39 (Actuals -> .)
NOT shift and go to state 51
MINUS shift and go to state 50
NUMBER shift and go to state 52
LPAREN shift and go to state 53
ID shift and go to state 55
Actuals shift and go to state 69
Expr shift and go to state 68
CallExpr shift and go to state 54
state 47
(36) CallStmt -> CallExpr SEMI .
RBRACE reduce using rule 36 (CallStmt -> CallExpr SEMI .)
ID reduce using rule 36 (CallStmt -> CallExpr SEMI .)
PRINT reduce using rule 36 (CallStmt -> CallExpr SEMI .)
RETURN reduce using rule 36 (CallStmt -> CallExpr SEMI .)
BREAK reduce using rule 36 (CallStmt -> CallExpr SEMI .)
CONTINUE reduce using rule 36 (CallStmt -> CallExpr SEMI .)
IF reduce using rule 36 (CallStmt -> CallExpr SEMI .)
WHILE reduce using rule 36 (CallStmt -> CallExpr SEMI .)
INT reduce using rule 36 (CallStmt -> CallExpr SEMI .)
CHAR reduce using rule 36 (CallStmt -> CallExpr SEMI .)
VOID reduce using rule 36 (CallStmt -> CallExpr SEMI .)
state 48
(40) ReturnStmt -> RETURN Expr . SEMI
(57) Expr -> Expr . PLUS Expr
(58) Expr -> Expr . MINUS Expr
(59) Expr -> Expr . TIMES Expr
(60) Expr -> Expr . DIVIDE Expr
(61) Expr -> Expr . LSHIFT Expr
(62) Expr -> Expr . RSHIFT Expr
(63) Expr -> Expr . LT Expr
(64) Expr -> Expr . GT Expr
(65) Expr -> Expr . EQ Expr
(66) Expr -> Expr . NE Expr
(67) Expr -> Expr . LE Expr
(68) Expr -> Expr . GE Expr
(69) Expr -> Expr . OR Expr
(70) Expr -> Expr . AND Expr
SEMI shift and go to state 70
PLUS shift and go to state 71
MINUS shift and go to state 72
TIMES shift and go to state 73
DIVIDE shift and go to state 74
LSHIFT shift and go to state 75
RSHIFT shift and go to state 76
LT shift and go to state 77
GT shift and go to state 78
EQ shift and go to state 79
NE shift and go to state 80
LE shift and go to state 81
GE shift and go to state 82
OR shift and go to state 83
AND shift and go to state 84
state 49
(41) ReturnStmt -> RETURN SEMI .
RBRACE reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
ID reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
PRINT reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
RETURN reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
BREAK reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
CONTINUE reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
IF reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
WHILE reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
INT reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
CHAR reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
VOID reduce using rule 41 (ReturnStmt -> RETURN SEMI .)
state 50
(72) Expr -> MINUS . Expr
(57) Expr -> . Expr PLUS Expr
(58) Expr -> . Expr MINUS Expr
(59) Expr -> . Expr TIMES Expr
(60) Expr -> . Expr DIVIDE Expr
(61) Expr -> . Expr LSHIFT Expr
(62) Expr -> . Expr RSHIFT Expr
(63) Expr -> . Expr LT Expr
(64) Expr -> . Expr GT Expr
(65) Expr -> . Expr EQ Expr
(66) Expr -> . Expr NE Expr
(67) Expr -> . Expr LE Expr
(68) Expr -> . Expr GE Expr
(69) Expr -> . Expr OR Expr
(70) Expr -> . Expr AND Expr
(71) Expr -> . NOT Expr
(72) Expr -> . MINUS Expr
(73) Expr -> . NUMBER
(74) Expr -> . LPAREN Expr RPAREN
(75) Expr -> . CallExpr
(76) Expr -> . ID
(37) CallExpr -> . ID LPAREN Actuals RPAREN
NOT shift and go to state 51
MINUS shift and go to state 50
NUMBER shift and go to state 52
LPAREN shift and go to state 53
ID shift and go to state 55
Expr shift and go to state 85
CallExpr shift and go to state 54
state 51
(71) Expr -> NOT . Expr
(57) Expr -> . Expr PLUS Expr
(58) Expr -> . Expr MINUS Expr
(59) Expr -> . Expr TIMES Expr
(60) Expr -> . Expr DIVIDE Expr
(61) Expr -> . Expr LSHIFT Expr
(62) Expr -> . Expr RSHIFT Expr
(63) Expr -> . Expr LT Expr
(64) Expr -> . Expr GT Expr
(65) Expr -> . Expr EQ Expr
(66) Expr -> . Expr NE Expr
(67) Expr -> . Expr LE Expr
(68) Expr -> . Expr GE Expr
(69) Expr -> . Expr OR Expr
(70) Expr -> . Expr AND Expr
(71) Expr -> . NOT Expr
(72) Expr -> . MINUS Expr
(73) Expr -> . NUMBER
(74) Expr -> . LPAREN Expr RPAREN
(75) Expr -> . CallExpr
(76) Expr -> . ID
(37) CallExpr -> . ID LPAREN Actuals RPAREN
NOT shift and go to state 51
MINUS shift and go to state 50
NUMBER shift and go to state 52
LPAREN shift and go to state 53
ID shift and go to state 55
Expr shift and go to state 86
CallExpr shift and go to state 54
state 52
(73) Expr -> NUMBER .