-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCminusParser.h
7731 lines (6837 loc) · 350 KB
/
CminusParser.h
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
#pragma once
#include <vector>
#include <string>
// Include the support for the parser.
#include "manta/generator/ParserDriver.h"
#include "manta/generator/LexerGenerator.h"
#include <Lightning/Lightning.h>
#include "manta/utility/Formatting.h"
using namespace manta::formatting;
using manta::ItemID;
#define REDUCE_ASSERT(count, item, size) \
MANTA_REQUIRE(count <= size, "in reduction " #item ", not enough nodes in the collect vector, needed at least " #count ", actual size was " << size)
// Forward declare AST node types.
struct ASTNodeGeneral_0_program;
struct ASTNodeBase_declList;
struct ASTNodeGeneral_1_declList;
struct ASTNodeGeneral_2_declList;
struct ASTNodeBase_decl;
struct ASTNodeGeneral_3_decl;
struct ASTNodeGeneral_4_decl;
struct ASTNodeGeneral_5_varDecl;
struct ASTNodeBase_funDecl;
struct ASTNodeGeneral_17_funDecl;
struct ASTNodeGeneral_18_funDecl;
struct ASTNodeBase_typeSpec;
struct ASTNodeGeneral_14_typeSpec;
struct ASTNodeGeneral_15_typeSpec;
struct ASTNodeGeneral_16_typeSpec;
struct ASTNodeBase_varDeclList;
struct ASTNodeGeneral_8_varDeclList;
struct ASTNodeGeneral_9_varDeclList;
struct ASTNodeBase_scopedVarDecl;
struct ASTNodeGeneral_6_scopedVarDecl;
struct ASTNodeGeneral_7_scopedVarDecl;
struct ASTNodeBase_varDeclInit;
struct ASTNodeGeneral_10_varDeclInit;
struct ASTNodeGeneral_11_varDeclInit;
struct ASTNodeBase_varDeclId;
struct ASTNodeGeneral_12_varDeclId;
struct ASTNodeGeneral_13_varDeclId;
struct ASTNodeBase_simpleExp;
struct ASTNodeGeneral_58_simpleExp;
struct ASTNodeGeneral_59_simpleExp;
struct ASTNodeBase_parms;
struct ASTNodeGeneral_19_parms;
struct ASTNodeGeneral_20_parms;
struct ASTNodeBase_stmt;
struct ASTNodeGeneral_28_stmt;
struct ASTNodeGeneral_29_stmt;
struct ASTNodeGeneral_30_stmt;
struct ASTNodeGeneral_31_stmt;
struct ASTNodeGeneral_32_stmt;
struct ASTNodeGeneral_33_stmt;
struct ASTNodeBase_parmList;
struct ASTNodeGeneral_21_parmList;
struct ASTNodeGeneral_22_parmList;
struct ASTNodeGeneral_23_parmTypeList;
struct ASTNodeBase_parmIdList;
struct ASTNodeGeneral_24_parmIdList;
struct ASTNodeGeneral_25_parmIdList;
struct ASTNodeBase_parmId;
struct ASTNodeGeneral_26_parmId;
struct ASTNodeGeneral_27_parmId;
struct ASTNodeBase_expStmt;
struct ASTNodeGeneral_34_expStmt;
struct ASTNodeGeneral_35_expStmt;
struct ASTNodeGeneral_36_compoundStmt;
struct ASTNodeBase_selectStmt;
struct ASTNodeGeneral_41_selectStmt;
struct ASTNodeGeneral_42_selectStmt;
struct ASTNodeBase_iterStmt;
struct ASTNodeGeneral_43_iterStmt;
struct ASTNodeGeneral_44_iterStmt;
struct ASTNodeBase_returnStmt;
struct ASTNodeGeneral_47_returnStmt;
struct ASTNodeGeneral_48_returnStmt;
struct ASTNodeGeneral_49_breakStmt;
struct ASTNodeBase_exp;
struct ASTNodeGeneral_50_exp;
struct ASTNodeGeneral_51_exp;
struct ASTNodeGeneral_52_exp;
struct ASTNodeGeneral_53_exp;
struct ASTNodeGeneral_54_exp;
struct ASTNodeGeneral_55_exp;
struct ASTNodeGeneral_56_exp;
struct ASTNodeGeneral_57_exp;
struct ASTNodeBase_localDecls;
struct ASTNodeGeneral_37_localDecls;
struct ASTNodeGeneral_38_localDecls;
struct ASTNodeBase_stmtList;
struct ASTNodeGeneral_39_stmtList;
struct ASTNodeGeneral_40_stmtList;
struct ASTNodeBase_iterRange;
struct ASTNodeGeneral_45_iterRange;
struct ASTNodeGeneral_46_iterRange;
struct ASTNodeBase_mutable;
struct ASTNodeGeneral_92_mutable;
struct ASTNodeGeneral_93_mutable;
struct ASTNodeBase_andExp;
struct ASTNodeGeneral_60_andExp;
struct ASTNodeGeneral_61_andExp;
struct ASTNodeBase_unaryRelExp;
struct ASTNodeGeneral_62_unaryRelExp;
struct ASTNodeGeneral_63_unaryRelExp;
struct ASTNodeBase_relExp;
struct ASTNodeGeneral_64_relExp;
struct ASTNodeGeneral_65_relExp;
struct ASTNodeBase_minmaxExp;
struct ASTNodeGeneral_72_minmaxExp;
struct ASTNodeGeneral_73_minmaxExp;
struct ASTNodeBase_relop;
struct ASTNodeGeneral_66_relop;
struct ASTNodeGeneral_67_relop;
struct ASTNodeGeneral_68_relop;
struct ASTNodeGeneral_69_relop;
struct ASTNodeGeneral_70_relop;
struct ASTNodeGeneral_71_relop;
struct ASTNodeBase_minmaxop;
struct ASTNodeGeneral_74_minmaxop;
struct ASTNodeGeneral_75_minmaxop;
struct ASTNodeBase_sumExp;
struct ASTNodeGeneral_76_sumExp;
struct ASTNodeGeneral_77_sumExp;
struct ASTNodeBase_sumop;
struct ASTNodeGeneral_78_sumop;
struct ASTNodeGeneral_79_sumop;
struct ASTNodeBase_mulExp;
struct ASTNodeGeneral_80_mulExp;
struct ASTNodeGeneral_81_mulExp;
struct ASTNodeBase_mulop;
struct ASTNodeGeneral_82_mulop;
struct ASTNodeGeneral_83_mulop;
struct ASTNodeGeneral_84_mulop;
struct ASTNodeBase_unaryExp;
struct ASTNodeGeneral_85_unaryExp;
struct ASTNodeGeneral_86_unaryExp;
struct ASTNodeBase_unaryop;
struct ASTNodeGeneral_87_unaryop;
struct ASTNodeGeneral_88_unaryop;
struct ASTNodeGeneral_89_unaryop;
struct ASTNodeBase_factor;
struct ASTNodeGeneral_90_factor;
struct ASTNodeGeneral_91_factor;
struct ASTNodeBase_immutable;
struct ASTNodeGeneral_94_immutable;
struct ASTNodeGeneral_95_immutable;
struct ASTNodeGeneral_96_immutable;
struct ASTNodeGeneral_97_call;
struct ASTNodeBase_constant;
struct ASTNodeGeneral_102_constant;
struct ASTNodeGeneral_103_constant;
struct ASTNodeGeneral_104_constant;
struct ASTNodeGeneral_105_constant;
struct ASTNodeGeneral_106_constant;
struct ASTNodeBase_args;
struct ASTNodeGeneral_98_args;
struct ASTNodeGeneral_99_args;
struct ASTNodeBase_argList;
struct ASTNodeGeneral_100_argList;
struct ASTNodeGeneral_101_argList;
// Lexeme type
struct ASTLexeme;
//! \brief Define the enums for each node type.
enum class ASTNodeType{
Literal,
Type_ASTNodeBase_andExp,
Type_ASTNodeBase_argList,
Type_ASTNodeBase_args,
Type_ASTNodeBase_constant,
Type_ASTNodeBase_decl,
Type_ASTNodeBase_declList,
Type_ASTNodeBase_exp,
Type_ASTNodeBase_expStmt,
Type_ASTNodeBase_factor,
Type_ASTNodeBase_funDecl,
Type_ASTNodeBase_immutable,
Type_ASTNodeBase_iterRange,
Type_ASTNodeBase_iterStmt,
Type_ASTNodeBase_localDecls,
Type_ASTNodeBase_minmaxExp,
Type_ASTNodeBase_minmaxop,
Type_ASTNodeBase_mulExp,
Type_ASTNodeBase_mulop,
Type_ASTNodeBase_mutable,
Type_ASTNodeBase_parmId,
Type_ASTNodeBase_parmIdList,
Type_ASTNodeBase_parmList,
Type_ASTNodeBase_parms,
Type_ASTNodeBase_relExp,
Type_ASTNodeBase_relop,
Type_ASTNodeBase_returnStmt,
Type_ASTNodeBase_scopedVarDecl,
Type_ASTNodeBase_selectStmt,
Type_ASTNodeBase_simpleExp,
Type_ASTNodeBase_stmt,
Type_ASTNodeBase_stmtList,
Type_ASTNodeBase_sumExp,
Type_ASTNodeBase_sumop,
Type_ASTNodeBase_typeSpec,
Type_ASTNodeBase_unaryExp,
Type_ASTNodeBase_unaryRelExp,
Type_ASTNodeBase_unaryop,
Type_ASTNodeBase_varDeclId,
Type_ASTNodeBase_varDeclInit,
Type_ASTNodeBase_varDeclList,
Type_ASTNodeGeneral_0_program,
Type_ASTNodeGeneral_100_argList,
Type_ASTNodeGeneral_101_argList,
Type_ASTNodeGeneral_102_constant,
Type_ASTNodeGeneral_103_constant,
Type_ASTNodeGeneral_104_constant,
Type_ASTNodeGeneral_105_constant,
Type_ASTNodeGeneral_106_constant,
Type_ASTNodeGeneral_10_varDeclInit,
Type_ASTNodeGeneral_11_varDeclInit,
Type_ASTNodeGeneral_12_varDeclId,
Type_ASTNodeGeneral_13_varDeclId,
Type_ASTNodeGeneral_14_typeSpec,
Type_ASTNodeGeneral_15_typeSpec,
Type_ASTNodeGeneral_16_typeSpec,
Type_ASTNodeGeneral_17_funDecl,
Type_ASTNodeGeneral_18_funDecl,
Type_ASTNodeGeneral_19_parms,
Type_ASTNodeGeneral_1_declList,
Type_ASTNodeGeneral_20_parms,
Type_ASTNodeGeneral_21_parmList,
Type_ASTNodeGeneral_22_parmList,
Type_ASTNodeGeneral_23_parmTypeList,
Type_ASTNodeGeneral_24_parmIdList,
Type_ASTNodeGeneral_25_parmIdList,
Type_ASTNodeGeneral_26_parmId,
Type_ASTNodeGeneral_27_parmId,
Type_ASTNodeGeneral_28_stmt,
Type_ASTNodeGeneral_29_stmt,
Type_ASTNodeGeneral_2_declList,
Type_ASTNodeGeneral_30_stmt,
Type_ASTNodeGeneral_31_stmt,
Type_ASTNodeGeneral_32_stmt,
Type_ASTNodeGeneral_33_stmt,
Type_ASTNodeGeneral_34_expStmt,
Type_ASTNodeGeneral_35_expStmt,
Type_ASTNodeGeneral_36_compoundStmt,
Type_ASTNodeGeneral_37_localDecls,
Type_ASTNodeGeneral_38_localDecls,
Type_ASTNodeGeneral_39_stmtList,
Type_ASTNodeGeneral_3_decl,
Type_ASTNodeGeneral_40_stmtList,
Type_ASTNodeGeneral_41_selectStmt,
Type_ASTNodeGeneral_42_selectStmt,
Type_ASTNodeGeneral_43_iterStmt,
Type_ASTNodeGeneral_44_iterStmt,
Type_ASTNodeGeneral_45_iterRange,
Type_ASTNodeGeneral_46_iterRange,
Type_ASTNodeGeneral_47_returnStmt,
Type_ASTNodeGeneral_48_returnStmt,
Type_ASTNodeGeneral_49_breakStmt,
Type_ASTNodeGeneral_4_decl,
Type_ASTNodeGeneral_50_exp,
Type_ASTNodeGeneral_51_exp,
Type_ASTNodeGeneral_52_exp,
Type_ASTNodeGeneral_53_exp,
Type_ASTNodeGeneral_54_exp,
Type_ASTNodeGeneral_55_exp,
Type_ASTNodeGeneral_56_exp,
Type_ASTNodeGeneral_57_exp,
Type_ASTNodeGeneral_58_simpleExp,
Type_ASTNodeGeneral_59_simpleExp,
Type_ASTNodeGeneral_5_varDecl,
Type_ASTNodeGeneral_60_andExp,
Type_ASTNodeGeneral_61_andExp,
Type_ASTNodeGeneral_62_unaryRelExp,
Type_ASTNodeGeneral_63_unaryRelExp,
Type_ASTNodeGeneral_64_relExp,
Type_ASTNodeGeneral_65_relExp,
Type_ASTNodeGeneral_66_relop,
Type_ASTNodeGeneral_67_relop,
Type_ASTNodeGeneral_68_relop,
Type_ASTNodeGeneral_69_relop,
Type_ASTNodeGeneral_6_scopedVarDecl,
Type_ASTNodeGeneral_70_relop,
Type_ASTNodeGeneral_71_relop,
Type_ASTNodeGeneral_72_minmaxExp,
Type_ASTNodeGeneral_73_minmaxExp,
Type_ASTNodeGeneral_74_minmaxop,
Type_ASTNodeGeneral_75_minmaxop,
Type_ASTNodeGeneral_76_sumExp,
Type_ASTNodeGeneral_77_sumExp,
Type_ASTNodeGeneral_78_sumop,
Type_ASTNodeGeneral_79_sumop,
Type_ASTNodeGeneral_7_scopedVarDecl,
Type_ASTNodeGeneral_80_mulExp,
Type_ASTNodeGeneral_81_mulExp,
Type_ASTNodeGeneral_82_mulop,
Type_ASTNodeGeneral_83_mulop,
Type_ASTNodeGeneral_84_mulop,
Type_ASTNodeGeneral_85_unaryExp,
Type_ASTNodeGeneral_86_unaryExp,
Type_ASTNodeGeneral_87_unaryop,
Type_ASTNodeGeneral_88_unaryop,
Type_ASTNodeGeneral_89_unaryop,
Type_ASTNodeGeneral_8_varDeclList,
Type_ASTNodeGeneral_90_factor,
Type_ASTNodeGeneral_91_factor,
Type_ASTNodeGeneral_92_mutable,
Type_ASTNodeGeneral_93_mutable,
Type_ASTNodeGeneral_94_immutable,
Type_ASTNodeGeneral_95_immutable,
Type_ASTNodeGeneral_96_immutable,
Type_ASTNodeGeneral_97_call,
Type_ASTNodeGeneral_98_args,
Type_ASTNodeGeneral_99_args,
Type_ASTNodeGeneral_9_varDeclList,
};
//! \brief Define function to write AST node type enums.
inline const char* to_string(ASTNodeType type) {
switch (type) {
case ASTNodeType::Literal:
return "Literal";
case ASTNodeType::Type_ASTNodeBase_andExp:
return "Type_ASTNodeBase_andExp";
case ASTNodeType::Type_ASTNodeBase_argList:
return "Type_ASTNodeBase_argList";
case ASTNodeType::Type_ASTNodeBase_args:
return "Type_ASTNodeBase_args";
case ASTNodeType::Type_ASTNodeBase_constant:
return "Type_ASTNodeBase_constant";
case ASTNodeType::Type_ASTNodeBase_decl:
return "Type_ASTNodeBase_decl";
case ASTNodeType::Type_ASTNodeBase_declList:
return "Type_ASTNodeBase_declList";
case ASTNodeType::Type_ASTNodeBase_exp:
return "Type_ASTNodeBase_exp";
case ASTNodeType::Type_ASTNodeBase_expStmt:
return "Type_ASTNodeBase_expStmt";
case ASTNodeType::Type_ASTNodeBase_factor:
return "Type_ASTNodeBase_factor";
case ASTNodeType::Type_ASTNodeBase_funDecl:
return "Type_ASTNodeBase_funDecl";
case ASTNodeType::Type_ASTNodeBase_immutable:
return "Type_ASTNodeBase_immutable";
case ASTNodeType::Type_ASTNodeBase_iterRange:
return "Type_ASTNodeBase_iterRange";
case ASTNodeType::Type_ASTNodeBase_iterStmt:
return "Type_ASTNodeBase_iterStmt";
case ASTNodeType::Type_ASTNodeBase_localDecls:
return "Type_ASTNodeBase_localDecls";
case ASTNodeType::Type_ASTNodeBase_minmaxExp:
return "Type_ASTNodeBase_minmaxExp";
case ASTNodeType::Type_ASTNodeBase_minmaxop:
return "Type_ASTNodeBase_minmaxop";
case ASTNodeType::Type_ASTNodeBase_mulExp:
return "Type_ASTNodeBase_mulExp";
case ASTNodeType::Type_ASTNodeBase_mulop:
return "Type_ASTNodeBase_mulop";
case ASTNodeType::Type_ASTNodeBase_mutable:
return "Type_ASTNodeBase_mutable";
case ASTNodeType::Type_ASTNodeBase_parmId:
return "Type_ASTNodeBase_parmId";
case ASTNodeType::Type_ASTNodeBase_parmIdList:
return "Type_ASTNodeBase_parmIdList";
case ASTNodeType::Type_ASTNodeBase_parmList:
return "Type_ASTNodeBase_parmList";
case ASTNodeType::Type_ASTNodeBase_parms:
return "Type_ASTNodeBase_parms";
case ASTNodeType::Type_ASTNodeBase_relExp:
return "Type_ASTNodeBase_relExp";
case ASTNodeType::Type_ASTNodeBase_relop:
return "Type_ASTNodeBase_relop";
case ASTNodeType::Type_ASTNodeBase_returnStmt:
return "Type_ASTNodeBase_returnStmt";
case ASTNodeType::Type_ASTNodeBase_scopedVarDecl:
return "Type_ASTNodeBase_scopedVarDecl";
case ASTNodeType::Type_ASTNodeBase_selectStmt:
return "Type_ASTNodeBase_selectStmt";
case ASTNodeType::Type_ASTNodeBase_simpleExp:
return "Type_ASTNodeBase_simpleExp";
case ASTNodeType::Type_ASTNodeBase_stmt:
return "Type_ASTNodeBase_stmt";
case ASTNodeType::Type_ASTNodeBase_stmtList:
return "Type_ASTNodeBase_stmtList";
case ASTNodeType::Type_ASTNodeBase_sumExp:
return "Type_ASTNodeBase_sumExp";
case ASTNodeType::Type_ASTNodeBase_sumop:
return "Type_ASTNodeBase_sumop";
case ASTNodeType::Type_ASTNodeBase_typeSpec:
return "Type_ASTNodeBase_typeSpec";
case ASTNodeType::Type_ASTNodeBase_unaryExp:
return "Type_ASTNodeBase_unaryExp";
case ASTNodeType::Type_ASTNodeBase_unaryRelExp:
return "Type_ASTNodeBase_unaryRelExp";
case ASTNodeType::Type_ASTNodeBase_unaryop:
return "Type_ASTNodeBase_unaryop";
case ASTNodeType::Type_ASTNodeBase_varDeclId:
return "Type_ASTNodeBase_varDeclId";
case ASTNodeType::Type_ASTNodeBase_varDeclInit:
return "Type_ASTNodeBase_varDeclInit";
case ASTNodeType::Type_ASTNodeBase_varDeclList:
return "Type_ASTNodeBase_varDeclList";
case ASTNodeType::Type_ASTNodeGeneral_0_program:
return "Type_ASTNodeGeneral_0_program";
case ASTNodeType::Type_ASTNodeGeneral_100_argList:
return "Type_ASTNodeGeneral_100_argList";
case ASTNodeType::Type_ASTNodeGeneral_101_argList:
return "Type_ASTNodeGeneral_101_argList";
case ASTNodeType::Type_ASTNodeGeneral_102_constant:
return "Type_ASTNodeGeneral_102_constant";
case ASTNodeType::Type_ASTNodeGeneral_103_constant:
return "Type_ASTNodeGeneral_103_constant";
case ASTNodeType::Type_ASTNodeGeneral_104_constant:
return "Type_ASTNodeGeneral_104_constant";
case ASTNodeType::Type_ASTNodeGeneral_105_constant:
return "Type_ASTNodeGeneral_105_constant";
case ASTNodeType::Type_ASTNodeGeneral_106_constant:
return "Type_ASTNodeGeneral_106_constant";
case ASTNodeType::Type_ASTNodeGeneral_10_varDeclInit:
return "Type_ASTNodeGeneral_10_varDeclInit";
case ASTNodeType::Type_ASTNodeGeneral_11_varDeclInit:
return "Type_ASTNodeGeneral_11_varDeclInit";
case ASTNodeType::Type_ASTNodeGeneral_12_varDeclId:
return "Type_ASTNodeGeneral_12_varDeclId";
case ASTNodeType::Type_ASTNodeGeneral_13_varDeclId:
return "Type_ASTNodeGeneral_13_varDeclId";
case ASTNodeType::Type_ASTNodeGeneral_14_typeSpec:
return "Type_ASTNodeGeneral_14_typeSpec";
case ASTNodeType::Type_ASTNodeGeneral_15_typeSpec:
return "Type_ASTNodeGeneral_15_typeSpec";
case ASTNodeType::Type_ASTNodeGeneral_16_typeSpec:
return "Type_ASTNodeGeneral_16_typeSpec";
case ASTNodeType::Type_ASTNodeGeneral_17_funDecl:
return "Type_ASTNodeGeneral_17_funDecl";
case ASTNodeType::Type_ASTNodeGeneral_18_funDecl:
return "Type_ASTNodeGeneral_18_funDecl";
case ASTNodeType::Type_ASTNodeGeneral_19_parms:
return "Type_ASTNodeGeneral_19_parms";
case ASTNodeType::Type_ASTNodeGeneral_1_declList:
return "Type_ASTNodeGeneral_1_declList";
case ASTNodeType::Type_ASTNodeGeneral_20_parms:
return "Type_ASTNodeGeneral_20_parms";
case ASTNodeType::Type_ASTNodeGeneral_21_parmList:
return "Type_ASTNodeGeneral_21_parmList";
case ASTNodeType::Type_ASTNodeGeneral_22_parmList:
return "Type_ASTNodeGeneral_22_parmList";
case ASTNodeType::Type_ASTNodeGeneral_23_parmTypeList:
return "Type_ASTNodeGeneral_23_parmTypeList";
case ASTNodeType::Type_ASTNodeGeneral_24_parmIdList:
return "Type_ASTNodeGeneral_24_parmIdList";
case ASTNodeType::Type_ASTNodeGeneral_25_parmIdList:
return "Type_ASTNodeGeneral_25_parmIdList";
case ASTNodeType::Type_ASTNodeGeneral_26_parmId:
return "Type_ASTNodeGeneral_26_parmId";
case ASTNodeType::Type_ASTNodeGeneral_27_parmId:
return "Type_ASTNodeGeneral_27_parmId";
case ASTNodeType::Type_ASTNodeGeneral_28_stmt:
return "Type_ASTNodeGeneral_28_stmt";
case ASTNodeType::Type_ASTNodeGeneral_29_stmt:
return "Type_ASTNodeGeneral_29_stmt";
case ASTNodeType::Type_ASTNodeGeneral_2_declList:
return "Type_ASTNodeGeneral_2_declList";
case ASTNodeType::Type_ASTNodeGeneral_30_stmt:
return "Type_ASTNodeGeneral_30_stmt";
case ASTNodeType::Type_ASTNodeGeneral_31_stmt:
return "Type_ASTNodeGeneral_31_stmt";
case ASTNodeType::Type_ASTNodeGeneral_32_stmt:
return "Type_ASTNodeGeneral_32_stmt";
case ASTNodeType::Type_ASTNodeGeneral_33_stmt:
return "Type_ASTNodeGeneral_33_stmt";
case ASTNodeType::Type_ASTNodeGeneral_34_expStmt:
return "Type_ASTNodeGeneral_34_expStmt";
case ASTNodeType::Type_ASTNodeGeneral_35_expStmt:
return "Type_ASTNodeGeneral_35_expStmt";
case ASTNodeType::Type_ASTNodeGeneral_36_compoundStmt:
return "Type_ASTNodeGeneral_36_compoundStmt";
case ASTNodeType::Type_ASTNodeGeneral_37_localDecls:
return "Type_ASTNodeGeneral_37_localDecls";
case ASTNodeType::Type_ASTNodeGeneral_38_localDecls:
return "Type_ASTNodeGeneral_38_localDecls";
case ASTNodeType::Type_ASTNodeGeneral_39_stmtList:
return "Type_ASTNodeGeneral_39_stmtList";
case ASTNodeType::Type_ASTNodeGeneral_3_decl:
return "Type_ASTNodeGeneral_3_decl";
case ASTNodeType::Type_ASTNodeGeneral_40_stmtList:
return "Type_ASTNodeGeneral_40_stmtList";
case ASTNodeType::Type_ASTNodeGeneral_41_selectStmt:
return "Type_ASTNodeGeneral_41_selectStmt";
case ASTNodeType::Type_ASTNodeGeneral_42_selectStmt:
return "Type_ASTNodeGeneral_42_selectStmt";
case ASTNodeType::Type_ASTNodeGeneral_43_iterStmt:
return "Type_ASTNodeGeneral_43_iterStmt";
case ASTNodeType::Type_ASTNodeGeneral_44_iterStmt:
return "Type_ASTNodeGeneral_44_iterStmt";
case ASTNodeType::Type_ASTNodeGeneral_45_iterRange:
return "Type_ASTNodeGeneral_45_iterRange";
case ASTNodeType::Type_ASTNodeGeneral_46_iterRange:
return "Type_ASTNodeGeneral_46_iterRange";
case ASTNodeType::Type_ASTNodeGeneral_47_returnStmt:
return "Type_ASTNodeGeneral_47_returnStmt";
case ASTNodeType::Type_ASTNodeGeneral_48_returnStmt:
return "Type_ASTNodeGeneral_48_returnStmt";
case ASTNodeType::Type_ASTNodeGeneral_49_breakStmt:
return "Type_ASTNodeGeneral_49_breakStmt";
case ASTNodeType::Type_ASTNodeGeneral_4_decl:
return "Type_ASTNodeGeneral_4_decl";
case ASTNodeType::Type_ASTNodeGeneral_50_exp:
return "Type_ASTNodeGeneral_50_exp";
case ASTNodeType::Type_ASTNodeGeneral_51_exp:
return "Type_ASTNodeGeneral_51_exp";
case ASTNodeType::Type_ASTNodeGeneral_52_exp:
return "Type_ASTNodeGeneral_52_exp";
case ASTNodeType::Type_ASTNodeGeneral_53_exp:
return "Type_ASTNodeGeneral_53_exp";
case ASTNodeType::Type_ASTNodeGeneral_54_exp:
return "Type_ASTNodeGeneral_54_exp";
case ASTNodeType::Type_ASTNodeGeneral_55_exp:
return "Type_ASTNodeGeneral_55_exp";
case ASTNodeType::Type_ASTNodeGeneral_56_exp:
return "Type_ASTNodeGeneral_56_exp";
case ASTNodeType::Type_ASTNodeGeneral_57_exp:
return "Type_ASTNodeGeneral_57_exp";
case ASTNodeType::Type_ASTNodeGeneral_58_simpleExp:
return "Type_ASTNodeGeneral_58_simpleExp";
case ASTNodeType::Type_ASTNodeGeneral_59_simpleExp:
return "Type_ASTNodeGeneral_59_simpleExp";
case ASTNodeType::Type_ASTNodeGeneral_5_varDecl:
return "Type_ASTNodeGeneral_5_varDecl";
case ASTNodeType::Type_ASTNodeGeneral_60_andExp:
return "Type_ASTNodeGeneral_60_andExp";
case ASTNodeType::Type_ASTNodeGeneral_61_andExp:
return "Type_ASTNodeGeneral_61_andExp";
case ASTNodeType::Type_ASTNodeGeneral_62_unaryRelExp:
return "Type_ASTNodeGeneral_62_unaryRelExp";
case ASTNodeType::Type_ASTNodeGeneral_63_unaryRelExp:
return "Type_ASTNodeGeneral_63_unaryRelExp";
case ASTNodeType::Type_ASTNodeGeneral_64_relExp:
return "Type_ASTNodeGeneral_64_relExp";
case ASTNodeType::Type_ASTNodeGeneral_65_relExp:
return "Type_ASTNodeGeneral_65_relExp";
case ASTNodeType::Type_ASTNodeGeneral_66_relop:
return "Type_ASTNodeGeneral_66_relop";
case ASTNodeType::Type_ASTNodeGeneral_67_relop:
return "Type_ASTNodeGeneral_67_relop";
case ASTNodeType::Type_ASTNodeGeneral_68_relop:
return "Type_ASTNodeGeneral_68_relop";
case ASTNodeType::Type_ASTNodeGeneral_69_relop:
return "Type_ASTNodeGeneral_69_relop";
case ASTNodeType::Type_ASTNodeGeneral_6_scopedVarDecl:
return "Type_ASTNodeGeneral_6_scopedVarDecl";
case ASTNodeType::Type_ASTNodeGeneral_70_relop:
return "Type_ASTNodeGeneral_70_relop";
case ASTNodeType::Type_ASTNodeGeneral_71_relop:
return "Type_ASTNodeGeneral_71_relop";
case ASTNodeType::Type_ASTNodeGeneral_72_minmaxExp:
return "Type_ASTNodeGeneral_72_minmaxExp";
case ASTNodeType::Type_ASTNodeGeneral_73_minmaxExp:
return "Type_ASTNodeGeneral_73_minmaxExp";
case ASTNodeType::Type_ASTNodeGeneral_74_minmaxop:
return "Type_ASTNodeGeneral_74_minmaxop";
case ASTNodeType::Type_ASTNodeGeneral_75_minmaxop:
return "Type_ASTNodeGeneral_75_minmaxop";
case ASTNodeType::Type_ASTNodeGeneral_76_sumExp:
return "Type_ASTNodeGeneral_76_sumExp";
case ASTNodeType::Type_ASTNodeGeneral_77_sumExp:
return "Type_ASTNodeGeneral_77_sumExp";
case ASTNodeType::Type_ASTNodeGeneral_78_sumop:
return "Type_ASTNodeGeneral_78_sumop";
case ASTNodeType::Type_ASTNodeGeneral_79_sumop:
return "Type_ASTNodeGeneral_79_sumop";
case ASTNodeType::Type_ASTNodeGeneral_7_scopedVarDecl:
return "Type_ASTNodeGeneral_7_scopedVarDecl";
case ASTNodeType::Type_ASTNodeGeneral_80_mulExp:
return "Type_ASTNodeGeneral_80_mulExp";
case ASTNodeType::Type_ASTNodeGeneral_81_mulExp:
return "Type_ASTNodeGeneral_81_mulExp";
case ASTNodeType::Type_ASTNodeGeneral_82_mulop:
return "Type_ASTNodeGeneral_82_mulop";
case ASTNodeType::Type_ASTNodeGeneral_83_mulop:
return "Type_ASTNodeGeneral_83_mulop";
case ASTNodeType::Type_ASTNodeGeneral_84_mulop:
return "Type_ASTNodeGeneral_84_mulop";
case ASTNodeType::Type_ASTNodeGeneral_85_unaryExp:
return "Type_ASTNodeGeneral_85_unaryExp";
case ASTNodeType::Type_ASTNodeGeneral_86_unaryExp:
return "Type_ASTNodeGeneral_86_unaryExp";
case ASTNodeType::Type_ASTNodeGeneral_87_unaryop:
return "Type_ASTNodeGeneral_87_unaryop";
case ASTNodeType::Type_ASTNodeGeneral_88_unaryop:
return "Type_ASTNodeGeneral_88_unaryop";
case ASTNodeType::Type_ASTNodeGeneral_89_unaryop:
return "Type_ASTNodeGeneral_89_unaryop";
case ASTNodeType::Type_ASTNodeGeneral_8_varDeclList:
return "Type_ASTNodeGeneral_8_varDeclList";
case ASTNodeType::Type_ASTNodeGeneral_90_factor:
return "Type_ASTNodeGeneral_90_factor";
case ASTNodeType::Type_ASTNodeGeneral_91_factor:
return "Type_ASTNodeGeneral_91_factor";
case ASTNodeType::Type_ASTNodeGeneral_92_mutable:
return "Type_ASTNodeGeneral_92_mutable";
case ASTNodeType::Type_ASTNodeGeneral_93_mutable:
return "Type_ASTNodeGeneral_93_mutable";
case ASTNodeType::Type_ASTNodeGeneral_94_immutable:
return "Type_ASTNodeGeneral_94_immutable";
case ASTNodeType::Type_ASTNodeGeneral_95_immutable:
return "Type_ASTNodeGeneral_95_immutable";
case ASTNodeType::Type_ASTNodeGeneral_96_immutable:
return "Type_ASTNodeGeneral_96_immutable";
case ASTNodeType::Type_ASTNodeGeneral_97_call:
return "Type_ASTNodeGeneral_97_call";
case ASTNodeType::Type_ASTNodeGeneral_98_args:
return "Type_ASTNodeGeneral_98_args";
case ASTNodeType::Type_ASTNodeGeneral_99_args:
return "Type_ASTNodeGeneral_99_args";
case ASTNodeType::Type_ASTNodeGeneral_9_varDeclList:
return "Type_ASTNodeGeneral_9_varDeclList";
// Default case for unrecognized enums.
default:
MANTA_FAIL("unrecognized enumeration");
}
}
//! \brief Define the enums for each non-terminal type.
enum class NonterminalType{
Terminal,
andExp,
argList,
args,
breakStmt,
call,
compoundStmt,
constant,
decl,
declList,
exp,
expStmt,
factor,
funDecl,
immutable,
iterRange,
iterStmt,
localDecls,
minmaxExp,
minmaxop,
mulExp,
mulop,
mutable_,
parmId,
parmIdList,
parmList,
parmTypeList,
parms,
program,
relExp,
relop,
returnStmt,
scopedVarDecl,
selectStmt,
simpleExp,
stmt,
stmtList,
sumExp,
sumop,
typeSpec,
unaryExp,
unaryRelExp,
unaryop,
varDecl,
varDeclId,
varDeclInit,
varDeclList,
};
//! \brief Define function to write the non-terminal type enum.
inline const char* to_string(NonterminalType type) {
switch (type) {
case NonterminalType::Terminal:
return "Terminal";
case NonterminalType::andExp:
return "andExp";
case NonterminalType::argList:
return "argList";
case NonterminalType::args:
return "args";
case NonterminalType::breakStmt:
return "breakStmt";
case NonterminalType::call:
return "call";
case NonterminalType::compoundStmt:
return "compoundStmt";
case NonterminalType::constant:
return "constant";
case NonterminalType::decl:
return "decl";
case NonterminalType::declList:
return "declList";
case NonterminalType::exp:
return "exp";
case NonterminalType::expStmt:
return "expStmt";
case NonterminalType::factor:
return "factor";
case NonterminalType::funDecl:
return "funDecl";
case NonterminalType::immutable:
return "immutable";
case NonterminalType::iterRange:
return "iterRange";
case NonterminalType::iterStmt:
return "iterStmt";
case NonterminalType::localDecls:
return "localDecls";
case NonterminalType::minmaxExp:
return "minmaxExp";
case NonterminalType::minmaxop:
return "minmaxop";
case NonterminalType::mulExp:
return "mulExp";
case NonterminalType::mulop:
return "mulop";
case NonterminalType::mutable_:
return "mutable_";
case NonterminalType::parmId:
return "parmId";
case NonterminalType::parmIdList:
return "parmIdList";
case NonterminalType::parmList:
return "parmList";
case NonterminalType::parmTypeList:
return "parmTypeList";
case NonterminalType::parms:
return "parms";
case NonterminalType::program:
return "program";
case NonterminalType::relExp:
return "relExp";
case NonterminalType::relop:
return "relop";
case NonterminalType::returnStmt:
return "returnStmt";
case NonterminalType::scopedVarDecl:
return "scopedVarDecl";
case NonterminalType::selectStmt:
return "selectStmt";
case NonterminalType::simpleExp:
return "simpleExp";
case NonterminalType::stmt:
return "stmt";
case NonterminalType::stmtList:
return "stmtList";
case NonterminalType::sumExp:
return "sumExp";
case NonterminalType::sumop:
return "sumop";
case NonterminalType::typeSpec:
return "typeSpec";
case NonterminalType::unaryExp:
return "unaryExp";
case NonterminalType::unaryRelExp:
return "unaryRelExp";
case NonterminalType::unaryop:
return "unaryop";
case NonterminalType::varDecl:
return "varDecl";
case NonterminalType::varDeclId:
return "varDeclId";
case NonterminalType::varDeclInit:
return "varDeclInit";
case NonterminalType::varDeclList:
return "varDeclList";
// Default case for unrecognized enums.
default:
MANTA_FAIL("unrecognized enumeration");
}
}
//! \brief Base visitor class.
struct ASTNodeVisitor {
virtual ~ASTNodeVisitor() = default;
virtual void Visit(ASTNodeGeneral_0_program& object) = 0;
virtual void Visit(ASTNodeBase_declList& object) = 0;
virtual void Visit(ASTNodeGeneral_1_declList& object) = 0;
virtual void Visit(ASTNodeGeneral_2_declList& object) = 0;
virtual void Visit(ASTNodeBase_decl& object) = 0;
virtual void Visit(ASTNodeGeneral_3_decl& object) = 0;
virtual void Visit(ASTNodeGeneral_4_decl& object) = 0;
virtual void Visit(ASTNodeGeneral_5_varDecl& object) = 0;
virtual void Visit(ASTNodeBase_funDecl& object) = 0;
virtual void Visit(ASTNodeGeneral_17_funDecl& object) = 0;
virtual void Visit(ASTNodeGeneral_18_funDecl& object) = 0;
virtual void Visit(ASTNodeBase_typeSpec& object) = 0;
virtual void Visit(ASTNodeGeneral_14_typeSpec& object) = 0;
virtual void Visit(ASTNodeGeneral_15_typeSpec& object) = 0;
virtual void Visit(ASTNodeGeneral_16_typeSpec& object) = 0;
virtual void Visit(ASTNodeBase_varDeclList& object) = 0;
virtual void Visit(ASTNodeGeneral_8_varDeclList& object) = 0;
virtual void Visit(ASTNodeGeneral_9_varDeclList& object) = 0;
virtual void Visit(ASTNodeBase_scopedVarDecl& object) = 0;
virtual void Visit(ASTNodeGeneral_6_scopedVarDecl& object) = 0;
virtual void Visit(ASTNodeGeneral_7_scopedVarDecl& object) = 0;
virtual void Visit(ASTNodeBase_varDeclInit& object) = 0;
virtual void Visit(ASTNodeGeneral_10_varDeclInit& object) = 0;
virtual void Visit(ASTNodeGeneral_11_varDeclInit& object) = 0;
virtual void Visit(ASTNodeBase_varDeclId& object) = 0;
virtual void Visit(ASTNodeGeneral_12_varDeclId& object) = 0;
virtual void Visit(ASTNodeGeneral_13_varDeclId& object) = 0;
virtual void Visit(ASTNodeBase_simpleExp& object) = 0;
virtual void Visit(ASTNodeGeneral_58_simpleExp& object) = 0;
virtual void Visit(ASTNodeGeneral_59_simpleExp& object) = 0;
virtual void Visit(ASTNodeBase_parms& object) = 0;
virtual void Visit(ASTNodeGeneral_19_parms& object) = 0;
virtual void Visit(ASTNodeGeneral_20_parms& object) = 0;
virtual void Visit(ASTNodeBase_stmt& object) = 0;
virtual void Visit(ASTNodeGeneral_28_stmt& object) = 0;
virtual void Visit(ASTNodeGeneral_29_stmt& object) = 0;
virtual void Visit(ASTNodeGeneral_30_stmt& object) = 0;
virtual void Visit(ASTNodeGeneral_31_stmt& object) = 0;
virtual void Visit(ASTNodeGeneral_32_stmt& object) = 0;
virtual void Visit(ASTNodeGeneral_33_stmt& object) = 0;
virtual void Visit(ASTNodeBase_parmList& object) = 0;
virtual void Visit(ASTNodeGeneral_21_parmList& object) = 0;
virtual void Visit(ASTNodeGeneral_22_parmList& object) = 0;
virtual void Visit(ASTNodeGeneral_23_parmTypeList& object) = 0;
virtual void Visit(ASTNodeBase_parmIdList& object) = 0;
virtual void Visit(ASTNodeGeneral_24_parmIdList& object) = 0;
virtual void Visit(ASTNodeGeneral_25_parmIdList& object) = 0;
virtual void Visit(ASTNodeBase_parmId& object) = 0;
virtual void Visit(ASTNodeGeneral_26_parmId& object) = 0;
virtual void Visit(ASTNodeGeneral_27_parmId& object) = 0;
virtual void Visit(ASTNodeBase_expStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_34_expStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_35_expStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_36_compoundStmt& object) = 0;
virtual void Visit(ASTNodeBase_selectStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_41_selectStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_42_selectStmt& object) = 0;
virtual void Visit(ASTNodeBase_iterStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_43_iterStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_44_iterStmt& object) = 0;
virtual void Visit(ASTNodeBase_returnStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_47_returnStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_48_returnStmt& object) = 0;
virtual void Visit(ASTNodeGeneral_49_breakStmt& object) = 0;
virtual void Visit(ASTNodeBase_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_50_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_51_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_52_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_53_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_54_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_55_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_56_exp& object) = 0;
virtual void Visit(ASTNodeGeneral_57_exp& object) = 0;
virtual void Visit(ASTNodeBase_localDecls& object) = 0;
virtual void Visit(ASTNodeGeneral_37_localDecls& object) = 0;
virtual void Visit(ASTNodeGeneral_38_localDecls& object) = 0;
virtual void Visit(ASTNodeBase_stmtList& object) = 0;
virtual void Visit(ASTNodeGeneral_39_stmtList& object) = 0;
virtual void Visit(ASTNodeGeneral_40_stmtList& object) = 0;
virtual void Visit(ASTNodeBase_iterRange& object) = 0;
virtual void Visit(ASTNodeGeneral_45_iterRange& object) = 0;
virtual void Visit(ASTNodeGeneral_46_iterRange& object) = 0;
virtual void Visit(ASTNodeBase_mutable& object) = 0;
virtual void Visit(ASTNodeGeneral_92_mutable& object) = 0;
virtual void Visit(ASTNodeGeneral_93_mutable& object) = 0;
virtual void Visit(ASTNodeBase_andExp& object) = 0;
virtual void Visit(ASTNodeGeneral_60_andExp& object) = 0;
virtual void Visit(ASTNodeGeneral_61_andExp& object) = 0;
virtual void Visit(ASTNodeBase_unaryRelExp& object) = 0;
virtual void Visit(ASTNodeGeneral_62_unaryRelExp& object) = 0;
virtual void Visit(ASTNodeGeneral_63_unaryRelExp& object) = 0;
virtual void Visit(ASTNodeBase_relExp& object) = 0;
virtual void Visit(ASTNodeGeneral_64_relExp& object) = 0;
virtual void Visit(ASTNodeGeneral_65_relExp& object) = 0;
virtual void Visit(ASTNodeBase_minmaxExp& object) = 0;
virtual void Visit(ASTNodeGeneral_72_minmaxExp& object) = 0;
virtual void Visit(ASTNodeGeneral_73_minmaxExp& object) = 0;
virtual void Visit(ASTNodeBase_relop& object) = 0;
virtual void Visit(ASTNodeGeneral_66_relop& object) = 0;
virtual void Visit(ASTNodeGeneral_67_relop& object) = 0;
virtual void Visit(ASTNodeGeneral_68_relop& object) = 0;
virtual void Visit(ASTNodeGeneral_69_relop& object) = 0;
virtual void Visit(ASTNodeGeneral_70_relop& object) = 0;
virtual void Visit(ASTNodeGeneral_71_relop& object) = 0;
virtual void Visit(ASTNodeBase_minmaxop& object) = 0;
virtual void Visit(ASTNodeGeneral_74_minmaxop& object) = 0;
virtual void Visit(ASTNodeGeneral_75_minmaxop& object) = 0;
virtual void Visit(ASTNodeBase_sumExp& object) = 0;
virtual void Visit(ASTNodeGeneral_76_sumExp& object) = 0;
virtual void Visit(ASTNodeGeneral_77_sumExp& object) = 0;
virtual void Visit(ASTNodeBase_sumop& object) = 0;
virtual void Visit(ASTNodeGeneral_78_sumop& object) = 0;
virtual void Visit(ASTNodeGeneral_79_sumop& object) = 0;
virtual void Visit(ASTNodeBase_mulExp& object) = 0;
virtual void Visit(ASTNodeGeneral_80_mulExp& object) = 0;
virtual void Visit(ASTNodeGeneral_81_mulExp& object) = 0;
virtual void Visit(ASTNodeBase_mulop& object) = 0;
virtual void Visit(ASTNodeGeneral_82_mulop& object) = 0;
virtual void Visit(ASTNodeGeneral_83_mulop& object) = 0;
virtual void Visit(ASTNodeGeneral_84_mulop& object) = 0;
virtual void Visit(ASTNodeBase_unaryExp& object) = 0;
virtual void Visit(ASTNodeGeneral_85_unaryExp& object) = 0;
virtual void Visit(ASTNodeGeneral_86_unaryExp& object) = 0;
virtual void Visit(ASTNodeBase_unaryop& object) = 0;
virtual void Visit(ASTNodeGeneral_87_unaryop& object) = 0;
virtual void Visit(ASTNodeGeneral_88_unaryop& object) = 0;
virtual void Visit(ASTNodeGeneral_89_unaryop& object) = 0;
virtual void Visit(ASTNodeBase_factor& object) = 0;
virtual void Visit(ASTNodeGeneral_90_factor& object) = 0;
virtual void Visit(ASTNodeGeneral_91_factor& object) = 0;
virtual void Visit(ASTNodeBase_immutable& object) = 0;
virtual void Visit(ASTNodeGeneral_94_immutable& object) = 0;
virtual void Visit(ASTNodeGeneral_95_immutable& object) = 0;
virtual void Visit(ASTNodeGeneral_96_immutable& object) = 0;
virtual void Visit(ASTNodeGeneral_97_call& object) = 0;
virtual void Visit(ASTNodeBase_constant& object) = 0;
virtual void Visit(ASTNodeGeneral_102_constant& object) = 0;
virtual void Visit(ASTNodeGeneral_103_constant& object) = 0;
virtual void Visit(ASTNodeGeneral_104_constant& object) = 0;
virtual void Visit(ASTNodeGeneral_105_constant& object) = 0;
virtual void Visit(ASTNodeGeneral_106_constant& object) = 0;
virtual void Visit(ASTNodeBase_args& object) = 0;
virtual void Visit(ASTNodeGeneral_98_args& object) = 0;
virtual void Visit(ASTNodeGeneral_99_args& object) = 0;
virtual void Visit(ASTNodeBase_argList& object) = 0;
virtual void Visit(ASTNodeGeneral_100_argList& object) = 0;
virtual void Visit(ASTNodeGeneral_101_argList& object) = 0;
virtual void Visit(ASTLexeme& object) = 0;
};
//! \brief Define the base node type for all AST nodes.
struct ASTNodeBase {
ASTNodeBase(const ASTNodeType& node_type, const NonterminalType& nonterminal_type, const ItemID& item_id)
: node_type(node_type), nonterminal_type(nonterminal_type), item_id(item_id) {}
virtual ~ASTNodeBase() = default;
ItemID item_id{};
ASTNodeType node_type{};
NonterminalType nonterminal_type{};
virtual void Accept(ASTNodeVisitor& visitor) = 0;
};
//! \brief Node for basic lexemes.
struct ASTLexeme : ASTNodeBase {
explicit ASTLexeme(const std::string& literal)
: ASTNodeBase(ASTNodeType::Literal, NonterminalType::Terminal, -1), literal(literal) {}
std::string literal{};
void Accept(ASTNodeVisitor& visitor) override {
visitor.Visit(*this);
}
};
// ============================================================
// Nodes for non-terminal 57's productions.
// ============================================================
struct ASTNodeGeneral_0_program : ASTNodeBase {
explicit ASTNodeGeneral_0_program(const ItemID& item_id)
: ASTNodeBase(ASTNodeType::Type_ASTNodeGeneral_0_program, NonterminalType::program, item_id) {}
std::shared_ptr<ASTNodeBase_declList> declList_node{};
void Accept(ASTNodeVisitor& visitor) override {
visitor.Visit(*this);
}
};
// ============================================================
// Nodes for non-terminal 58's productions.
// ============================================================
//! \brief Parent type for non-terminal type 58
struct ASTNodeBase_declList : ASTNodeBase {
ASTNodeBase_declList(const ASTNodeType& node_type, const ItemID& item_id)
: ASTNodeBase(node_type, NonterminalType::declList, item_id) {}
std::shared_ptr<ASTNodeBase_decl> decl_node{};
void Accept(ASTNodeVisitor& visitor) override {
visitor.Visit(*this);
}
};
struct ASTNodeGeneral_1_declList : ASTNodeBase_declList {
explicit ASTNodeGeneral_1_declList(const ItemID& item_id)
: ASTNodeBase_declList(ASTNodeType::Type_ASTNodeGeneral_1_declList, item_id) {}
std::shared_ptr<ASTNodeBase_declList> declList_node{};
void Accept(ASTNodeVisitor& visitor) override {
visitor.Visit(*this);
}
};