-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathptucc_parser.output
5815 lines (4727 loc) · 250 KB
/
ptucc_parser.output
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
Terminals unused in grammar
TK_COMMON_CHARS
TK_ESCAPE_CHARS
TK_EOF
State 65 conflicts: 1 shift/reduce
State 126 conflicts: 1 shift/reduce
State 155 conflicts: 1 shift/reduce
State 158 conflicts: 2 shift/reduce
Grammar
0 $accept: project $end
1 project: program_declaration declarations main_body DOT
2 program_declaration: TK_PROGRAM TK_IDENTIFIER SEMICOLON
3 declarations: variable_declaration procedure_declaration function_declaration
4 variable_declaration: %empty
5 | TK_VAR declares
6 declares: var_declaration
7 | declares var_declaration
8 var_declaration: multi_identifiers COLON data_type SEMICOLON
9 | multi_identifiers COLON array_declaration SEMICOLON
10 array_declaration: TK_ARRAY TK_OF data_type
11 | TK_ARRAY array_size TK_OF data_type
12 array_size: LEFT_BRACKET TK_POSITIVEINT RIGHT_BRACKET
13 | array_size LEFT_BRACKET TK_POSITIVEINT RIGHT_BRACKET
14 multi_identifiers: TK_IDENTIFIER
15 | multi_identifiers TK_COMMA TK_IDENTIFIER
16 main_body: TK_BEGIN commands TK_END
17 commands: %empty
18 | simple_commands
19 simple_commands: simple_command
20 | simple_commands simple_command
21 simple_nonsimple_commands: simple_command
22 | nonsimple_command
23 simple_command: expressions SEMICOLON
24 | TK_IDENTIFIER ASSIGNMENT TK_CONSTANT_STRING SEMICOLON
25 | TK_IDENTIFIER ASSIGNMENT expressions SEMICOLON
26 | TK_IDENTIFIER ASSIGNMENT boolean_value SEMICOLON
27 | TK_IDENTIFIER ASSIGNMENT TK_READSTRING LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
28 | TK_IDENTIFIER ASSIGNMENT TK_READINTEGER LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
29 | TK_IDENTIFIER ASSIGNMENT TK_READREAL LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
30 | TK_RESULT ASSIGNMENT expressions SEMICOLON
31 | TK_WRITESTRING LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
32 | TK_WRITESTRING LEFT_PARENTHESIS TK_CONSTANT_STRING RIGHT_PARENTHESIS SEMICOLON
33 | TK_WRITEINTEGER LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
34 | TK_WRITEREAL LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
35 | if_command
36 | for_command
37 | while_command
38 | do_while_command
39 | label
40 | goto_label
41 | TK_RETURN
42 data_type: TK_INTEGER
43 | TK_BOOLEAN
44 | TK_CHAR
45 | TK_REAL
46 boolean_value: TK_TRUE
47 | TK_FALSE
48 nonsimple_command: TK_BEGIN simple_commands TK_END
49 expressions: operators
50 | expressions OP_OR expressions
51 | LEFT_PARENTHESIS data_type RIGHT_PARENTHESIS operators
52 | expressions TK_OR expressions
53 | expressions OP_AND expressions
54 | expressions TK_AND expressions
55 | expressions OP_EQUAL expressions
56 | expressions OP_NOTEQUAL expressions
57 | expressions OP_LESS expressions
58 | expressions OP_GREATER expressions
59 | expressions OP_LESSEQUAL expressions
60 | expressions OP_GREATEREQUAL expressions
61 | OP_PLUS expressions
62 | OP_MINUS expressions
63 | expressions OP_MULT expressions
64 | expressions OP_DIV expressions
65 | expressions TK_DIV expressions
66 | expressions TK_MOD expressions
67 | expressions OP_PLUS expressions
68 | expressions OP_MINUS expressions
69 | TK_NOT expressions
70 | OP_NOT expressions
71 | LEFT_PARENTHESIS expressions RIGHT_PARENTHESIS
72 | TK_IDENTIFIER LEFT_PARENTHESIS function RIGHT_PARENTHESIS
73 | boolean_value
74 operators: TK_POSITIVEREAL
75 | TK_POSITIVEINT
76 | TK_IDENTIFIER
77 if_command: TK_IF expressions TK_THEN simple_nonsimple_commands else_tag
78 for_command: TK_FOR TK_IDENTIFIER ASSIGNMENT expressions TK_TO expressions TK_DO simple_nonsimple_commands
79 | TK_FOR TK_IDENTIFIER ASSIGNMENT expressions TK_DOWNTO expressions TK_DO simple_nonsimple_commands
80 while_command: TK_WHILE expressions TK_DO simple_nonsimple_commands
81 do_while_command: TK_REPEAT simple_nonsimple_commands TK_UNTIL expressions
82 label: TK_IDENTIFIER COLON
83 goto_label: TK_GOTO TK_IDENTIFIER SEMICOLON
84 else_tag: %empty
85 | TK_ELSE simple_nonsimple_commands
86 function: %empty
87 | expressions
88 | function TK_COMMA expressions
89 function_declaration: %empty
90 | function_declaration TK_FUNCTION TK_IDENTIFIER LEFT_PARENTHESIS parameters RIGHT_PARENTHESIS return_type SEMICOLON variable_declaration TK_BEGIN commands TK_END SEMICOLON
91 procedure_declaration: %empty
92 | procedure_declaration TK_PROCEDURE TK_IDENTIFIER LEFT_PARENTHESIS parameters RIGHT_PARENTHESIS SEMICOLON test
93 test: variable_declaration function_declaration TK_BEGIN commands TK_END SEMICOLON
94 parameters: %empty
95 | single_param
96 | parameters SEMICOLON single_param
97 single_param: multi_identifiers COLON data_type
98 | multi_identifiers COLON array_declaration
99 return_type: %empty
100 | COLON data_type
101 | COLON array_declaration
Terminals, with rules where they appear
$end (0) 0
error (256)
TK_AND (258) 54
TK_ARRAY (259) 10 11
TK_BOOLEAN (260) 43
TK_CHAR (261) 44
TK_BEGIN (262) 16 48 90 93
TK_DIV (263) 65
TK_DO (264) 78 79 80
TK_ELSE (265) 85
TK_FOR (266) 78 79
TK_END (267) 16 48 90 93
TK_FUNCTION (268) 90
TK_GOTO (269) 83
TK_IF (270) 77
TK_INTEGER (271) 42
TK_VAR (272) 5
TK_MOD (273) 66
TK_NOT (274) 69
TK_OF (275) 10 11
TK_OR (276) 52
TK_WHILE (277) 80
TK_PROCEDURE (278) 92
TK_PROGRAM (279) 2
TK_REAL (280) 45
TK_REPEAT (281) 81
TK_TO (282) 78
TK_RESULT (283) 30
TK_RETURN (284) 41
TK_THEN (285) 77
TK_UNTIL (286) 81
TK_DOWNTO (287) 79
TK_TRUE (288) 46
TK_FALSE (289) 47
TK_READSTRING (290) 27
TK_READINTEGER (291) 28
TK_READREAL (292) 29
TK_WRITESTRING (293) 31 32
TK_WRITEINTEGER (294) 33
TK_WRITEREAL (295) 34
TK_IDENTIFIER (296) 2 14 15 24 25 26 27 28 29 31 33 34 72 76 78 79
82 83 90 92
TK_POSITIVEINT (297) 12 13 75
TK_POSITIVEREAL (298) 74
TK_COMMON_CHARS (299)
TK_ESCAPE_CHARS (300)
TK_CONSTANT_STRING (301) 24 32
OP_PLUS (302) 61 67
OP_MINUS (303) 62 68
OP_MULT (304) 63
OP_DIV (305) 64
OP_EQUAL (306) 55
OP_NOTEQUAL (307) 56
OP_LESS (308) 57
OP_GREATER (309) 58
OP_LESSEQUAL (310) 59
OP_GREATEREQUAL (311) 60
OP_AND (312) 53
OP_OR (313) 50
OP_NOT (314) 70
ASSIGNMENT (315) 24 25 26 27 28 29 30 78 79
SEMICOLON (316) 2 8 9 23 24 25 26 27 28 29 30 31 32 33 34 83 90 92
93 96
LEFT_PARENTHESIS (317) 27 28 29 31 32 33 34 51 71 72 90 92
RIGHT_PARENTHESIS (318) 27 28 29 31 32 33 34 51 71 72 90 92
TK_COMMA (319) 15 88
LEFT_BRACKET (320) 12 13
RIGHT_BRACKET (321) 12 13
COLON (322) 8 9 82 97 98 100 101
DOT (323) 1
TK_EOF (324)
Nonterminals, with rules where they appear
$accept (70)
on left: 0
project (71)
on left: 1, on right: 0
program_declaration (72)
on left: 2, on right: 1
declarations (73)
on left: 3, on right: 1
variable_declaration (74)
on left: 4 5, on right: 3 90 93
declares (75)
on left: 6 7, on right: 5 7
var_declaration (76)
on left: 8 9, on right: 6 7
array_declaration (77)
on left: 10 11, on right: 9 98 101
array_size (78)
on left: 12 13, on right: 11 13
multi_identifiers (79)
on left: 14 15, on right: 8 9 15 97 98
main_body (80)
on left: 16, on right: 1
commands (81)
on left: 17 18, on right: 16 90 93
simple_commands (82)
on left: 19 20, on right: 18 20 48
simple_nonsimple_commands (83)
on left: 21 22, on right: 77 78 79 80 81 85
simple_command (84)
on left: 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41, on right: 19 20 21
data_type (85)
on left: 42 43 44 45, on right: 8 10 11 51 97 100
boolean_value (86)
on left: 46 47, on right: 26 73
nonsimple_command (87)
on left: 48, on right: 22
expressions (88)
on left: 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, on right: 23 25 30 50 52 53 54 55 56 57 58
59 60 61 62 63 64 65 66 67 68 69 70 71 77 78 79 80 81 87 88
operators (89)
on left: 74 75 76, on right: 49 51
if_command (90)
on left: 77, on right: 35
for_command (91)
on left: 78 79, on right: 36
while_command (92)
on left: 80, on right: 37
do_while_command (93)
on left: 81, on right: 38
label (94)
on left: 82, on right: 39
goto_label (95)
on left: 83, on right: 40
else_tag (96)
on left: 84 85, on right: 77
function (97)
on left: 86 87 88, on right: 72 88
function_declaration (98)
on left: 89 90, on right: 3 90 93
procedure_declaration (99)
on left: 91 92, on right: 3 92
test (100)
on left: 93, on right: 92
parameters (101)
on left: 94 95 96, on right: 90 92 96
single_param (102)
on left: 97 98, on right: 95 96
return_type (103)
on left: 99 100 101, on right: 90
State 0
0 $accept: . project $end
1 project: . program_declaration declarations main_body DOT
2 program_declaration: . TK_PROGRAM TK_IDENTIFIER SEMICOLON
TK_PROGRAM shift, and go to state 1
project go to state 2
program_declaration go to state 3
State 1
2 program_declaration: TK_PROGRAM . TK_IDENTIFIER SEMICOLON
TK_IDENTIFIER shift, and go to state 4
State 2
0 $accept: project . $end
$end shift, and go to state 5
State 3
1 project: program_declaration . declarations main_body DOT
3 declarations: . variable_declaration procedure_declaration function_declaration
4 variable_declaration: . %empty [TK_BEGIN, TK_FUNCTION, TK_PROCEDURE]
5 | . TK_VAR declares
TK_VAR shift, and go to state 6
$default reduce using rule 4 (variable_declaration)
declarations go to state 7
variable_declaration go to state 8
State 4
2 program_declaration: TK_PROGRAM TK_IDENTIFIER . SEMICOLON
SEMICOLON shift, and go to state 9
State 5
0 $accept: project $end .
$default accept
State 6
5 variable_declaration: TK_VAR . declares
6 declares: . var_declaration
7 | . declares var_declaration
8 var_declaration: . multi_identifiers COLON data_type SEMICOLON
9 | . multi_identifiers COLON array_declaration SEMICOLON
14 multi_identifiers: . TK_IDENTIFIER
15 | . multi_identifiers TK_COMMA TK_IDENTIFIER
TK_IDENTIFIER shift, and go to state 10
declares go to state 11
var_declaration go to state 12
multi_identifiers go to state 13
State 7
1 project: program_declaration declarations . main_body DOT
16 main_body: . TK_BEGIN commands TK_END
TK_BEGIN shift, and go to state 14
main_body go to state 15
State 8
3 declarations: variable_declaration . procedure_declaration function_declaration
91 procedure_declaration: . %empty
92 | . procedure_declaration TK_PROCEDURE TK_IDENTIFIER LEFT_PARENTHESIS parameters RIGHT_PARENTHESIS SEMICOLON test
$default reduce using rule 91 (procedure_declaration)
procedure_declaration go to state 16
State 9
2 program_declaration: TK_PROGRAM TK_IDENTIFIER SEMICOLON .
$default reduce using rule 2 (program_declaration)
State 10
14 multi_identifiers: TK_IDENTIFIER .
$default reduce using rule 14 (multi_identifiers)
State 11
5 variable_declaration: TK_VAR declares . [TK_BEGIN, TK_FUNCTION, TK_PROCEDURE]
7 declares: declares . var_declaration
8 var_declaration: . multi_identifiers COLON data_type SEMICOLON
9 | . multi_identifiers COLON array_declaration SEMICOLON
14 multi_identifiers: . TK_IDENTIFIER
15 | . multi_identifiers TK_COMMA TK_IDENTIFIER
TK_IDENTIFIER shift, and go to state 10
$default reduce using rule 5 (variable_declaration)
var_declaration go to state 17
multi_identifiers go to state 13
State 12
6 declares: var_declaration .
$default reduce using rule 6 (declares)
State 13
8 var_declaration: multi_identifiers . COLON data_type SEMICOLON
9 | multi_identifiers . COLON array_declaration SEMICOLON
15 multi_identifiers: multi_identifiers . TK_COMMA TK_IDENTIFIER
TK_COMMA shift, and go to state 18
COLON shift, and go to state 19
State 14
16 main_body: TK_BEGIN . commands TK_END
17 commands: . %empty [TK_END]
18 | . simple_commands
19 simple_commands: . simple_command
20 | . simple_commands simple_command
23 simple_command: . expressions SEMICOLON
24 | . TK_IDENTIFIER ASSIGNMENT TK_CONSTANT_STRING SEMICOLON
25 | . TK_IDENTIFIER ASSIGNMENT expressions SEMICOLON
26 | . TK_IDENTIFIER ASSIGNMENT boolean_value SEMICOLON
27 | . TK_IDENTIFIER ASSIGNMENT TK_READSTRING LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
28 | . TK_IDENTIFIER ASSIGNMENT TK_READINTEGER LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
29 | . TK_IDENTIFIER ASSIGNMENT TK_READREAL LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
30 | . TK_RESULT ASSIGNMENT expressions SEMICOLON
31 | . TK_WRITESTRING LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
32 | . TK_WRITESTRING LEFT_PARENTHESIS TK_CONSTANT_STRING RIGHT_PARENTHESIS SEMICOLON
33 | . TK_WRITEINTEGER LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
34 | . TK_WRITEREAL LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
35 | . if_command
36 | . for_command
37 | . while_command
38 | . do_while_command
39 | . label
40 | . goto_label
41 | . TK_RETURN
46 boolean_value: . TK_TRUE
47 | . TK_FALSE
49 expressions: . operators
50 | . expressions OP_OR expressions
51 | . LEFT_PARENTHESIS data_type RIGHT_PARENTHESIS operators
52 | . expressions TK_OR expressions
53 | . expressions OP_AND expressions
54 | . expressions TK_AND expressions
55 | . expressions OP_EQUAL expressions
56 | . expressions OP_NOTEQUAL expressions
57 | . expressions OP_LESS expressions
58 | . expressions OP_GREATER expressions
59 | . expressions OP_LESSEQUAL expressions
60 | . expressions OP_GREATEREQUAL expressions
61 | . OP_PLUS expressions
62 | . OP_MINUS expressions
63 | . expressions OP_MULT expressions
64 | . expressions OP_DIV expressions
65 | . expressions TK_DIV expressions
66 | . expressions TK_MOD expressions
67 | . expressions OP_PLUS expressions
68 | . expressions OP_MINUS expressions
69 | . TK_NOT expressions
70 | . OP_NOT expressions
71 | . LEFT_PARENTHESIS expressions RIGHT_PARENTHESIS
72 | . TK_IDENTIFIER LEFT_PARENTHESIS function RIGHT_PARENTHESIS
73 | . boolean_value
74 operators: . TK_POSITIVEREAL
75 | . TK_POSITIVEINT
76 | . TK_IDENTIFIER
77 if_command: . TK_IF expressions TK_THEN simple_nonsimple_commands else_tag
78 for_command: . TK_FOR TK_IDENTIFIER ASSIGNMENT expressions TK_TO expressions TK_DO simple_nonsimple_commands
79 | . TK_FOR TK_IDENTIFIER ASSIGNMENT expressions TK_DOWNTO expressions TK_DO simple_nonsimple_commands
80 while_command: . TK_WHILE expressions TK_DO simple_nonsimple_commands
81 do_while_command: . TK_REPEAT simple_nonsimple_commands TK_UNTIL expressions
82 label: . TK_IDENTIFIER COLON
83 goto_label: . TK_GOTO TK_IDENTIFIER SEMICOLON
TK_FOR shift, and go to state 20
TK_GOTO shift, and go to state 21
TK_IF shift, and go to state 22
TK_NOT shift, and go to state 23
TK_WHILE shift, and go to state 24
TK_REPEAT shift, and go to state 25
TK_RESULT shift, and go to state 26
TK_RETURN shift, and go to state 27
TK_TRUE shift, and go to state 28
TK_FALSE shift, and go to state 29
TK_WRITESTRING shift, and go to state 30
TK_WRITEINTEGER shift, and go to state 31
TK_WRITEREAL shift, and go to state 32
TK_IDENTIFIER shift, and go to state 33
TK_POSITIVEINT shift, and go to state 34
TK_POSITIVEREAL shift, and go to state 35
OP_PLUS shift, and go to state 36
OP_MINUS shift, and go to state 37
OP_NOT shift, and go to state 38
LEFT_PARENTHESIS shift, and go to state 39
$default reduce using rule 17 (commands)
commands go to state 40
simple_commands go to state 41
simple_command go to state 42
boolean_value go to state 43
expressions go to state 44
operators go to state 45
if_command go to state 46
for_command go to state 47
while_command go to state 48
do_while_command go to state 49
label go to state 50
goto_label go to state 51
State 15
1 project: program_declaration declarations main_body . DOT
DOT shift, and go to state 52
State 16
3 declarations: variable_declaration procedure_declaration . function_declaration
89 function_declaration: . %empty [TK_BEGIN, TK_FUNCTION]
90 | . function_declaration TK_FUNCTION TK_IDENTIFIER LEFT_PARENTHESIS parameters RIGHT_PARENTHESIS return_type SEMICOLON variable_declaration TK_BEGIN commands TK_END SEMICOLON
92 procedure_declaration: procedure_declaration . TK_PROCEDURE TK_IDENTIFIER LEFT_PARENTHESIS parameters RIGHT_PARENTHESIS SEMICOLON test
TK_PROCEDURE shift, and go to state 53
$default reduce using rule 89 (function_declaration)
function_declaration go to state 54
State 17
7 declares: declares var_declaration .
$default reduce using rule 7 (declares)
State 18
15 multi_identifiers: multi_identifiers TK_COMMA . TK_IDENTIFIER
TK_IDENTIFIER shift, and go to state 55
State 19
8 var_declaration: multi_identifiers COLON . data_type SEMICOLON
9 | multi_identifiers COLON . array_declaration SEMICOLON
10 array_declaration: . TK_ARRAY TK_OF data_type
11 | . TK_ARRAY array_size TK_OF data_type
42 data_type: . TK_INTEGER
43 | . TK_BOOLEAN
44 | . TK_CHAR
45 | . TK_REAL
TK_ARRAY shift, and go to state 56
TK_BOOLEAN shift, and go to state 57
TK_CHAR shift, and go to state 58
TK_INTEGER shift, and go to state 59
TK_REAL shift, and go to state 60
array_declaration go to state 61
data_type go to state 62
State 20
78 for_command: TK_FOR . TK_IDENTIFIER ASSIGNMENT expressions TK_TO expressions TK_DO simple_nonsimple_commands
79 | TK_FOR . TK_IDENTIFIER ASSIGNMENT expressions TK_DOWNTO expressions TK_DO simple_nonsimple_commands
TK_IDENTIFIER shift, and go to state 63
State 21
83 goto_label: TK_GOTO . TK_IDENTIFIER SEMICOLON
TK_IDENTIFIER shift, and go to state 64
State 22
46 boolean_value: . TK_TRUE
47 | . TK_FALSE
49 expressions: . operators
50 | . expressions OP_OR expressions
51 | . LEFT_PARENTHESIS data_type RIGHT_PARENTHESIS operators
52 | . expressions TK_OR expressions
53 | . expressions OP_AND expressions
54 | . expressions TK_AND expressions
55 | . expressions OP_EQUAL expressions
56 | . expressions OP_NOTEQUAL expressions
57 | . expressions OP_LESS expressions
58 | . expressions OP_GREATER expressions
59 | . expressions OP_LESSEQUAL expressions
60 | . expressions OP_GREATEREQUAL expressions
61 | . OP_PLUS expressions
62 | . OP_MINUS expressions
63 | . expressions OP_MULT expressions
64 | . expressions OP_DIV expressions
65 | . expressions TK_DIV expressions
66 | . expressions TK_MOD expressions
67 | . expressions OP_PLUS expressions
68 | . expressions OP_MINUS expressions
69 | . TK_NOT expressions
70 | . OP_NOT expressions
71 | . LEFT_PARENTHESIS expressions RIGHT_PARENTHESIS
72 | . TK_IDENTIFIER LEFT_PARENTHESIS function RIGHT_PARENTHESIS
73 | . boolean_value
74 operators: . TK_POSITIVEREAL
75 | . TK_POSITIVEINT
76 | . TK_IDENTIFIER
77 if_command: TK_IF . expressions TK_THEN simple_nonsimple_commands else_tag
TK_NOT shift, and go to state 23
TK_TRUE shift, and go to state 28
TK_FALSE shift, and go to state 29
TK_IDENTIFIER shift, and go to state 65
TK_POSITIVEINT shift, and go to state 34
TK_POSITIVEREAL shift, and go to state 35
OP_PLUS shift, and go to state 36
OP_MINUS shift, and go to state 37
OP_NOT shift, and go to state 38
LEFT_PARENTHESIS shift, and go to state 39
boolean_value go to state 43
expressions go to state 66
operators go to state 45
State 23
46 boolean_value: . TK_TRUE
47 | . TK_FALSE
49 expressions: . operators
50 | . expressions OP_OR expressions
51 | . LEFT_PARENTHESIS data_type RIGHT_PARENTHESIS operators
52 | . expressions TK_OR expressions
53 | . expressions OP_AND expressions
54 | . expressions TK_AND expressions
55 | . expressions OP_EQUAL expressions
56 | . expressions OP_NOTEQUAL expressions
57 | . expressions OP_LESS expressions
58 | . expressions OP_GREATER expressions
59 | . expressions OP_LESSEQUAL expressions
60 | . expressions OP_GREATEREQUAL expressions
61 | . OP_PLUS expressions
62 | . OP_MINUS expressions
63 | . expressions OP_MULT expressions
64 | . expressions OP_DIV expressions
65 | . expressions TK_DIV expressions
66 | . expressions TK_MOD expressions
67 | . expressions OP_PLUS expressions
68 | . expressions OP_MINUS expressions
69 | . TK_NOT expressions
69 | TK_NOT . expressions
70 | . OP_NOT expressions
71 | . LEFT_PARENTHESIS expressions RIGHT_PARENTHESIS
72 | . TK_IDENTIFIER LEFT_PARENTHESIS function RIGHT_PARENTHESIS
73 | . boolean_value
74 operators: . TK_POSITIVEREAL
75 | . TK_POSITIVEINT
76 | . TK_IDENTIFIER
TK_NOT shift, and go to state 23
TK_TRUE shift, and go to state 28
TK_FALSE shift, and go to state 29
TK_IDENTIFIER shift, and go to state 65
TK_POSITIVEINT shift, and go to state 34
TK_POSITIVEREAL shift, and go to state 35
OP_PLUS shift, and go to state 36
OP_MINUS shift, and go to state 37
OP_NOT shift, and go to state 38
LEFT_PARENTHESIS shift, and go to state 39
boolean_value go to state 43
expressions go to state 67
operators go to state 45
State 24
46 boolean_value: . TK_TRUE
47 | . TK_FALSE
49 expressions: . operators
50 | . expressions OP_OR expressions
51 | . LEFT_PARENTHESIS data_type RIGHT_PARENTHESIS operators
52 | . expressions TK_OR expressions
53 | . expressions OP_AND expressions
54 | . expressions TK_AND expressions
55 | . expressions OP_EQUAL expressions
56 | . expressions OP_NOTEQUAL expressions
57 | . expressions OP_LESS expressions
58 | . expressions OP_GREATER expressions
59 | . expressions OP_LESSEQUAL expressions
60 | . expressions OP_GREATEREQUAL expressions
61 | . OP_PLUS expressions
62 | . OP_MINUS expressions
63 | . expressions OP_MULT expressions
64 | . expressions OP_DIV expressions
65 | . expressions TK_DIV expressions
66 | . expressions TK_MOD expressions
67 | . expressions OP_PLUS expressions
68 | . expressions OP_MINUS expressions
69 | . TK_NOT expressions
70 | . OP_NOT expressions
71 | . LEFT_PARENTHESIS expressions RIGHT_PARENTHESIS
72 | . TK_IDENTIFIER LEFT_PARENTHESIS function RIGHT_PARENTHESIS
73 | . boolean_value
74 operators: . TK_POSITIVEREAL
75 | . TK_POSITIVEINT
76 | . TK_IDENTIFIER
80 while_command: TK_WHILE . expressions TK_DO simple_nonsimple_commands
TK_NOT shift, and go to state 23
TK_TRUE shift, and go to state 28
TK_FALSE shift, and go to state 29
TK_IDENTIFIER shift, and go to state 65
TK_POSITIVEINT shift, and go to state 34
TK_POSITIVEREAL shift, and go to state 35
OP_PLUS shift, and go to state 36
OP_MINUS shift, and go to state 37
OP_NOT shift, and go to state 38
LEFT_PARENTHESIS shift, and go to state 39
boolean_value go to state 43
expressions go to state 68
operators go to state 45
State 25
21 simple_nonsimple_commands: . simple_command
22 | . nonsimple_command
23 simple_command: . expressions SEMICOLON
24 | . TK_IDENTIFIER ASSIGNMENT TK_CONSTANT_STRING SEMICOLON
25 | . TK_IDENTIFIER ASSIGNMENT expressions SEMICOLON
26 | . TK_IDENTIFIER ASSIGNMENT boolean_value SEMICOLON
27 | . TK_IDENTIFIER ASSIGNMENT TK_READSTRING LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
28 | . TK_IDENTIFIER ASSIGNMENT TK_READINTEGER LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
29 | . TK_IDENTIFIER ASSIGNMENT TK_READREAL LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
30 | . TK_RESULT ASSIGNMENT expressions SEMICOLON
31 | . TK_WRITESTRING LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
32 | . TK_WRITESTRING LEFT_PARENTHESIS TK_CONSTANT_STRING RIGHT_PARENTHESIS SEMICOLON
33 | . TK_WRITEINTEGER LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
34 | . TK_WRITEREAL LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
35 | . if_command
36 | . for_command
37 | . while_command
38 | . do_while_command
39 | . label
40 | . goto_label
41 | . TK_RETURN
46 boolean_value: . TK_TRUE
47 | . TK_FALSE
48 nonsimple_command: . TK_BEGIN simple_commands TK_END
49 expressions: . operators
50 | . expressions OP_OR expressions
51 | . LEFT_PARENTHESIS data_type RIGHT_PARENTHESIS operators
52 | . expressions TK_OR expressions
53 | . expressions OP_AND expressions
54 | . expressions TK_AND expressions
55 | . expressions OP_EQUAL expressions
56 | . expressions OP_NOTEQUAL expressions
57 | . expressions OP_LESS expressions
58 | . expressions OP_GREATER expressions
59 | . expressions OP_LESSEQUAL expressions
60 | . expressions OP_GREATEREQUAL expressions
61 | . OP_PLUS expressions
62 | . OP_MINUS expressions
63 | . expressions OP_MULT expressions
64 | . expressions OP_DIV expressions
65 | . expressions TK_DIV expressions
66 | . expressions TK_MOD expressions
67 | . expressions OP_PLUS expressions
68 | . expressions OP_MINUS expressions
69 | . TK_NOT expressions
70 | . OP_NOT expressions
71 | . LEFT_PARENTHESIS expressions RIGHT_PARENTHESIS
72 | . TK_IDENTIFIER LEFT_PARENTHESIS function RIGHT_PARENTHESIS
73 | . boolean_value
74 operators: . TK_POSITIVEREAL
75 | . TK_POSITIVEINT
76 | . TK_IDENTIFIER
77 if_command: . TK_IF expressions TK_THEN simple_nonsimple_commands else_tag
78 for_command: . TK_FOR TK_IDENTIFIER ASSIGNMENT expressions TK_TO expressions TK_DO simple_nonsimple_commands
79 | . TK_FOR TK_IDENTIFIER ASSIGNMENT expressions TK_DOWNTO expressions TK_DO simple_nonsimple_commands
80 while_command: . TK_WHILE expressions TK_DO simple_nonsimple_commands
81 do_while_command: . TK_REPEAT simple_nonsimple_commands TK_UNTIL expressions
81 | TK_REPEAT . simple_nonsimple_commands TK_UNTIL expressions
82 label: . TK_IDENTIFIER COLON
83 goto_label: . TK_GOTO TK_IDENTIFIER SEMICOLON
TK_BEGIN shift, and go to state 69
TK_FOR shift, and go to state 20
TK_GOTO shift, and go to state 21
TK_IF shift, and go to state 22
TK_NOT shift, and go to state 23
TK_WHILE shift, and go to state 24
TK_REPEAT shift, and go to state 25
TK_RESULT shift, and go to state 26
TK_RETURN shift, and go to state 27
TK_TRUE shift, and go to state 28
TK_FALSE shift, and go to state 29
TK_WRITESTRING shift, and go to state 30
TK_WRITEINTEGER shift, and go to state 31
TK_WRITEREAL shift, and go to state 32
TK_IDENTIFIER shift, and go to state 33
TK_POSITIVEINT shift, and go to state 34
TK_POSITIVEREAL shift, and go to state 35
OP_PLUS shift, and go to state 36
OP_MINUS shift, and go to state 37
OP_NOT shift, and go to state 38
LEFT_PARENTHESIS shift, and go to state 39
simple_nonsimple_commands go to state 70
simple_command go to state 71
boolean_value go to state 43
nonsimple_command go to state 72
expressions go to state 44
operators go to state 45
if_command go to state 46
for_command go to state 47
while_command go to state 48
do_while_command go to state 49
label go to state 50
goto_label go to state 51
State 26
30 simple_command: TK_RESULT . ASSIGNMENT expressions SEMICOLON
ASSIGNMENT shift, and go to state 73
State 27
41 simple_command: TK_RETURN .
$default reduce using rule 41 (simple_command)
State 28
46 boolean_value: TK_TRUE .
$default reduce using rule 46 (boolean_value)
State 29
47 boolean_value: TK_FALSE .
$default reduce using rule 47 (boolean_value)
State 30
31 simple_command: TK_WRITESTRING . LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
32 | TK_WRITESTRING . LEFT_PARENTHESIS TK_CONSTANT_STRING RIGHT_PARENTHESIS SEMICOLON
LEFT_PARENTHESIS shift, and go to state 74
State 31
33 simple_command: TK_WRITEINTEGER . LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
LEFT_PARENTHESIS shift, and go to state 75
State 32
34 simple_command: TK_WRITEREAL . LEFT_PARENTHESIS TK_IDENTIFIER RIGHT_PARENTHESIS SEMICOLON
LEFT_PARENTHESIS shift, and go to state 76
State 33
24 simple_command: TK_IDENTIFIER . ASSIGNMENT TK_CONSTANT_STRING SEMICOLON
25 | TK_IDENTIFIER . ASSIGNMENT expressions SEMICOLON
26 | TK_IDENTIFIER . ASSIGNMENT boolean_value SEMICOLON
27 | TK_IDENTIFIER . ASSIGNMENT TK_READSTRING LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
28 | TK_IDENTIFIER . ASSIGNMENT TK_READINTEGER LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
29 | TK_IDENTIFIER . ASSIGNMENT TK_READREAL LEFT_PARENTHESIS RIGHT_PARENTHESIS SEMICOLON
72 expressions: TK_IDENTIFIER . LEFT_PARENTHESIS function RIGHT_PARENTHESIS
76 operators: TK_IDENTIFIER . [TK_AND, TK_DIV, TK_MOD, TK_OR, OP_PLUS, OP_MINUS, OP_MULT, OP_DIV, OP_EQUAL, OP_NOTEQUAL, OP_LESS, OP_GREATER, OP_LESSEQUAL, OP_GREATEREQUAL, OP_AND, OP_OR, SEMICOLON]
82 label: TK_IDENTIFIER . COLON
ASSIGNMENT shift, and go to state 77
LEFT_PARENTHESIS shift, and go to state 78
COLON shift, and go to state 79
$default reduce using rule 76 (operators)
State 34
75 operators: TK_POSITIVEINT .
$default reduce using rule 75 (operators)
State 35
74 operators: TK_POSITIVEREAL .
$default reduce using rule 74 (operators)
State 36
46 boolean_value: . TK_TRUE
47 | . TK_FALSE
49 expressions: . operators
50 | . expressions OP_OR expressions
51 | . LEFT_PARENTHESIS data_type RIGHT_PARENTHESIS operators
52 | . expressions TK_OR expressions
53 | . expressions OP_AND expressions
54 | . expressions TK_AND expressions
55 | . expressions OP_EQUAL expressions
56 | . expressions OP_NOTEQUAL expressions
57 | . expressions OP_LESS expressions
58 | . expressions OP_GREATER expressions
59 | . expressions OP_LESSEQUAL expressions
60 | . expressions OP_GREATEREQUAL expressions
61 | . OP_PLUS expressions
61 | OP_PLUS . expressions
62 | . OP_MINUS expressions
63 | . expressions OP_MULT expressions
64 | . expressions OP_DIV expressions
65 | . expressions TK_DIV expressions
66 | . expressions TK_MOD expressions
67 | . expressions OP_PLUS expressions
68 | . expressions OP_MINUS expressions
69 | . TK_NOT expressions
70 | . OP_NOT expressions
71 | . LEFT_PARENTHESIS expressions RIGHT_PARENTHESIS
72 | . TK_IDENTIFIER LEFT_PARENTHESIS function RIGHT_PARENTHESIS
73 | . boolean_value
74 operators: . TK_POSITIVEREAL
75 | . TK_POSITIVEINT
76 | . TK_IDENTIFIER
TK_NOT shift, and go to state 23
TK_TRUE shift, and go to state 28
TK_FALSE shift, and go to state 29
TK_IDENTIFIER shift, and go to state 65
TK_POSITIVEINT shift, and go to state 34
TK_POSITIVEREAL shift, and go to state 35
OP_PLUS shift, and go to state 36
OP_MINUS shift, and go to state 37
OP_NOT shift, and go to state 38
LEFT_PARENTHESIS shift, and go to state 39
boolean_value go to state 43
expressions go to state 80
operators go to state 45
State 37
46 boolean_value: . TK_TRUE