-
Notifications
You must be signed in to change notification settings - Fork 1
/
Skeleton.c
1286 lines (1230 loc) · 36.1 KB
/
Skeleton.c
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
/*** BNFC-Generated Visitor Traversal Skeleton. ***/
/* This traverses the abstract syntax tree.
To use, copy Skeleton.h and Skeleton.c to
new files. */
#include <stdlib.h>
#include <stdio.h>
#include "Skeleton.h"
void visitExternal_declaration(External_declaration _p_)
{
switch(_p_->kind)
{
case is_Class:
/* Code for Class Goes Here */
visitClassName(_p_->u.class_.classname_);
visitExtends(_p_->u.class_.extends_);
visitListExternal_declaration(_p_->u.class_.listexternal_declaration_);
break; case is_Namespace:
/* Code for Namespace Goes Here */
visitIdent(_p_->u.namespace_.ident_);
visitListExternal_declaration(_p_->u.namespace_.listexternal_declaration_);
break; case is_Afunc:
/* Code for Afunc Goes Here */
visitFunction_def(_p_->u.afunc_.function_def_);
break; case is_Global:
/* Code for Global Goes Here */
visitDec(_p_->u.global_.dec_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing External_declaration!\n");
exit(1);
}
}
void visitClassName(ClassName _p_)
{
switch(_p_->kind)
{
case is_ClassWithNamespace:
/* Code for ClassWithNamespace Goes Here */
visitIdent(_p_->u.classwithnamespace_.ident_1);
visitIdent(_p_->u.classwithnamespace_.ident_2);
break; case is_ClassWithoutNamespace:
/* Code for ClassWithoutNamespace Goes Here */
visitIdent(_p_->u.classwithoutnamespace_.ident_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing ClassName!\n");
exit(1);
}
}
void visitExtends(Extends _p_)
{
switch(_p_->kind)
{
case is_Inheritance:
/* Code for Inheritance Goes Here */
visitClassName(_p_->u.inheritance_.classname_);
break; case is_NoInheritance:
/* Code for NoInheritance Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Extends!\n");
exit(1);
}
}
void visitJump_stm(Jump_stm _p_)
{
switch(_p_->kind)
{
case is_SjumpFour:
/* Code for SjumpFour Goes Here */
break; case is_SjumpFive:
/* Code for SjumpFive Goes Here */
visitExp(_p_->u.sjumpfive_.exp_);
break; case is_SjumpOne:
/* Code for SjumpOne Goes Here */
visitIdent(_p_->u.sjumpone_.ident_);
break; case is_SjumpTwo:
/* Code for SjumpTwo Goes Here */
break; case is_SjumpThree:
/* Code for SjumpThree Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Jump_stm!\n");
exit(1);
}
}
void visitType_specifier(Type_specifier _p_)
{
switch(_p_->kind)
{
case is_Tvoid:
/* Code for Tvoid Goes Here */
break; case is_Tchar:
/* Code for Tchar Goes Here */
break; case is_Tshort:
/* Code for Tshort Goes Here */
break; case is_Tint:
/* Code for Tint Goes Here */
break; case is_Tlong:
/* Code for Tlong Goes Here */
break; case is_Tfloat:
/* Code for Tfloat Goes Here */
break; case is_Tdouble:
/* Code for Tdouble Goes Here */
break; case is_Tsigned:
/* Code for Tsigned Goes Here */
break; case is_Tunsigned:
/* Code for Tunsigned Goes Here */
break; case is_Tstruct:
/* Code for Tstruct Goes Here */
visitStruct_or_union_spec(_p_->u.tstruct_.struct_or_union_spec_);
break; case is_Tenum:
/* Code for Tenum Goes Here */
visitEnum_specifier(_p_->u.tenum_.enum_specifier_);
break; case is_Tname:
/* Code for Tname Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Type_specifier!\n");
exit(1);
}
}
void visitStorage_class_specifier(Storage_class_specifier _p_)
{
switch(_p_->kind)
{
case is_MyType:
/* Code for MyType Goes Here */
break; case is_GlobalPrograms:
/* Code for GlobalPrograms Goes Here */
break; case is_LocalProgram:
/* Code for LocalProgram Goes Here */
break; case is_LocalBlock:
/* Code for LocalBlock Goes Here */
break; case is_LocalReg:
/* Code for LocalReg Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Storage_class_specifier!\n");
exit(1);
}
}
void visitType_qualifier(Type_qualifier _p_)
{
switch(_p_->kind)
{
case is_Const:
/* Code for Const Goes Here */
break; case is_NoOptim:
/* Code for NoOptim Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Type_qualifier!\n");
exit(1);
}
}
void visitUnary_operator(Unary_operator _p_)
{
switch(_p_->kind)
{
case is_Logicalneg:
/* Code for Logicalneg Goes Here */
break; case is_Address:
/* Code for Address Goes Here */
break; case is_Indirection:
/* Code for Indirection Goes Here */
break; case is_Plus:
/* Code for Plus Goes Here */
break; case is_Negative:
/* Code for Negative Goes Here */
break; case is_Complement:
/* Code for Complement Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Unary_operator!\n");
exit(1);
}
}
void visitAssignment_op(Assignment_op _p_)
{
switch(_p_->kind)
{
case is_Assign:
/* Code for Assign Goes Here */
break; case is_AssignMul:
/* Code for AssignMul Goes Here */
break; case is_AssignDiv:
/* Code for AssignDiv Goes Here */
break; case is_AssignMod:
/* Code for AssignMod Goes Here */
break; case is_AssignAdd:
/* Code for AssignAdd Goes Here */
break; case is_AssignSub:
/* Code for AssignSub Goes Here */
break; case is_AssignLeft:
/* Code for AssignLeft Goes Here */
break; case is_AssignRight:
/* Code for AssignRight Goes Here */
break; case is_AssignAnd:
/* Code for AssignAnd Goes Here */
break; case is_AssignXor:
/* Code for AssignXor Goes Here */
break; case is_AssignOr:
/* Code for AssignOr Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Assignment_op!\n");
exit(1);
}
}
void visitInit_declarator(Init_declarator _p_)
{
switch(_p_->kind)
{
case is_InitDecl:
/* Code for InitDecl Goes Here */
visitDeclarator(_p_->u.initdecl_.declarator_);
visitInitializer(_p_->u.initdecl_.initializer_);
break; case is_OnlyDecl:
/* Code for OnlyDecl Goes Here */
visitDeclarator(_p_->u.onlydecl_.declarator_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Init_declarator!\n");
exit(1);
}
}
void visitEnumerator(Enumerator _p_)
{
switch(_p_->kind)
{
case is_EnumInit:
/* Code for EnumInit Goes Here */
visitIdent(_p_->u.enuminit_.ident_);
visitConstant_expression(_p_->u.enuminit_.constant_expression_);
break; case is_Plain:
/* Code for Plain Goes Here */
visitIdent(_p_->u.plain_.ident_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Enumerator!\n");
exit(1);
}
}
void visitExp(Exp _p_)
{
switch(_p_->kind)
{
case is_InitClass:
/* Code for InitClass Goes Here */
visitExp(_p_->u.initclass_.exp_);
visitAssignment_op(_p_->u.initclass_.assignment_op_);
visitClassName(_p_->u.initclass_.classname_);
break; case is_DestroyClass:
/* Code for DestroyClass Goes Here */
visitIdent(_p_->u.destroyclass_.ident_);
break; case is_Eassign:
/* Code for Eassign Goes Here */
visitExp(_p_->u.eassign_.exp_1);
visitAssignment_op(_p_->u.eassign_.assignment_op_);
visitExp(_p_->u.eassign_.exp_2);
break; case is_Ecomma:
/* Code for Ecomma Goes Here */
visitExp(_p_->u.ecomma_.exp_1);
visitExp(_p_->u.ecomma_.exp_2);
break; case is_Econdition:
/* Code for Econdition Goes Here */
visitExp(_p_->u.econdition_.exp_1);
visitExp(_p_->u.econdition_.exp_2);
visitExp(_p_->u.econdition_.exp_3);
break; case is_Elor:
/* Code for Elor Goes Here */
visitExp(_p_->u.elor_.exp_1);
visitExp(_p_->u.elor_.exp_2);
break; case is_Eland:
/* Code for Eland Goes Here */
visitExp(_p_->u.eland_.exp_1);
visitExp(_p_->u.eland_.exp_2);
break; case is_Ebitor:
/* Code for Ebitor Goes Here */
visitExp(_p_->u.ebitor_.exp_1);
visitExp(_p_->u.ebitor_.exp_2);
break; case is_Ebitexor:
/* Code for Ebitexor Goes Here */
visitExp(_p_->u.ebitexor_.exp_1);
visitExp(_p_->u.ebitexor_.exp_2);
break; case is_Ebitand:
/* Code for Ebitand Goes Here */
visitExp(_p_->u.ebitand_.exp_1);
visitExp(_p_->u.ebitand_.exp_2);
break; case is_Eeq:
/* Code for Eeq Goes Here */
visitExp(_p_->u.eeq_.exp_1);
visitExp(_p_->u.eeq_.exp_2);
break; case is_Eneq:
/* Code for Eneq Goes Here */
visitExp(_p_->u.eneq_.exp_1);
visitExp(_p_->u.eneq_.exp_2);
break; case is_Elthen:
/* Code for Elthen Goes Here */
visitExp(_p_->u.elthen_.exp_1);
visitExp(_p_->u.elthen_.exp_2);
break; case is_Egrthen:
/* Code for Egrthen Goes Here */
visitExp(_p_->u.egrthen_.exp_1);
visitExp(_p_->u.egrthen_.exp_2);
break; case is_Ele:
/* Code for Ele Goes Here */
visitExp(_p_->u.ele_.exp_1);
visitExp(_p_->u.ele_.exp_2);
break; case is_Ege:
/* Code for Ege Goes Here */
visitExp(_p_->u.ege_.exp_1);
visitExp(_p_->u.ege_.exp_2);
break; case is_Eleft:
/* Code for Eleft Goes Here */
visitExp(_p_->u.eleft_.exp_1);
visitExp(_p_->u.eleft_.exp_2);
break; case is_Eright:
/* Code for Eright Goes Here */
visitExp(_p_->u.eright_.exp_1);
visitExp(_p_->u.eright_.exp_2);
break; case is_Eplus:
/* Code for Eplus Goes Here */
visitExp(_p_->u.eplus_.exp_1);
visitExp(_p_->u.eplus_.exp_2);
break; case is_Eminus:
/* Code for Eminus Goes Here */
visitExp(_p_->u.eminus_.exp_1);
visitExp(_p_->u.eminus_.exp_2);
break; case is_Etimes:
/* Code for Etimes Goes Here */
visitExp(_p_->u.etimes_.exp_1);
visitExp(_p_->u.etimes_.exp_2);
break; case is_Ediv:
/* Code for Ediv Goes Here */
visitExp(_p_->u.ediv_.exp_1);
visitExp(_p_->u.ediv_.exp_2);
break; case is_Emod:
/* Code for Emod Goes Here */
visitExp(_p_->u.emod_.exp_1);
visitExp(_p_->u.emod_.exp_2);
break; case is_Etypeconv:
/* Code for Etypeconv Goes Here */
visitType_name(_p_->u.etypeconv_.type_name_);
visitExp(_p_->u.etypeconv_.exp_);
break; case is_Epreinc:
/* Code for Epreinc Goes Here */
visitExp(_p_->u.epreinc_.exp_);
break; case is_Epredec:
/* Code for Epredec Goes Here */
visitExp(_p_->u.epredec_.exp_);
break; case is_Epreop:
/* Code for Epreop Goes Here */
visitUnary_operator(_p_->u.epreop_.unary_operator_);
visitExp(_p_->u.epreop_.exp_);
break; case is_Ebytesexpr:
/* Code for Ebytesexpr Goes Here */
visitExp(_p_->u.ebytesexpr_.exp_);
break; case is_Ebytestype:
/* Code for Ebytestype Goes Here */
visitType_name(_p_->u.ebytestype_.type_name_);
break; case is_Earray:
/* Code for Earray Goes Here */
visitExp(_p_->u.earray_.exp_1);
visitExp(_p_->u.earray_.exp_2);
break; case is_Efunk:
/* Code for Efunk Goes Here */
visitExp(_p_->u.efunk_.exp_);
break; case is_Efunkpar:
/* Code for Efunkpar Goes Here */
visitExp(_p_->u.efunkpar_.exp_);
visitListExp(_p_->u.efunkpar_.listexp_);
break; case is_Eselect:
/* Code for Eselect Goes Here */
visitExp(_p_->u.eselect_.exp_);
visitIdent(_p_->u.eselect_.ident_);
break; case is_Epoint:
/* Code for Epoint Goes Here */
visitExp(_p_->u.epoint_.exp_);
visitIdent(_p_->u.epoint_.ident_);
break; case is_Epostinc:
/* Code for Epostinc Goes Here */
visitExp(_p_->u.epostinc_.exp_);
break; case is_Epostdec:
/* Code for Epostdec Goes Here */
visitExp(_p_->u.epostdec_.exp_);
break; case is_Evar:
/* Code for Evar Goes Here */
visitIdent(_p_->u.evar_.ident_);
break; case is_Econst:
/* Code for Econst Goes Here */
visitConstant(_p_->u.econst_.constant_);
break; case is_Estring:
/* Code for Estring Goes Here */
visitString(_p_->u.estring_.string_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Exp!\n");
exit(1);
}
}
void visitDeclaration_specifier(Declaration_specifier _p_)
{
switch(_p_->kind)
{
case is_DecClass:
/* Code for DecClass Goes Here */
visitClassName(_p_->u.decclass_.classname_);
visitPointer(_p_->u.decclass_.pointer_);
visitIdent(_p_->u.decclass_.ident_);
break; case is_DecClassNoPoiter:
/* Code for DecClassNoPoiter Goes Here */
visitClassName(_p_->u.decclassnopoiter_.classname_);
visitIdent(_p_->u.decclassnopoiter_.ident_);
break; case is_Type:
/* Code for Type Goes Here */
visitType_specifier(_p_->u.type_.type_specifier_);
break; case is_Storage:
/* Code for Storage Goes Here */
visitStorage_class_specifier(_p_->u.storage_.storage_class_specifier_);
break; case is_SpecProp:
/* Code for SpecProp Goes Here */
visitType_qualifier(_p_->u.specprop_.type_qualifier_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Declaration_specifier!\n");
exit(1);
}
}
void visitProgram(Program _p_)
{
switch(_p_->kind)
{
case is_Progr:
/* Code for Progr Goes Here */
visitListExternal_declaration(_p_->u.progr_.listexternal_declaration_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Program!\n");
exit(1);
}
}
void visitListExternal_declaration(ListExternal_declaration listexternal_declaration)
{
while(listexternal_declaration != 0)
{
/* Code For ListExternal_declaration Goes Here */
visitExternal_declaration(listexternal_declaration->external_declaration_);
listexternal_declaration = listexternal_declaration->listexternal_declaration_;
}
}
void visitFunction_def(Function_def _p_)
{
switch(_p_->kind)
{
case is_OldFunc:
/* Code for OldFunc Goes Here */
visitListDeclaration_specifier(_p_->u.oldfunc_.listdeclaration_specifier_);
visitDeclarator(_p_->u.oldfunc_.declarator_);
visitListDec(_p_->u.oldfunc_.listdec_);
visitCompound_stm(_p_->u.oldfunc_.compound_stm_);
break; case is_NewFunc:
/* Code for NewFunc Goes Here */
visitListDeclaration_specifier(_p_->u.newfunc_.listdeclaration_specifier_);
visitDeclarator(_p_->u.newfunc_.declarator_);
visitCompound_stm(_p_->u.newfunc_.compound_stm_);
break; case is_OldFuncInt:
/* Code for OldFuncInt Goes Here */
visitDeclarator(_p_->u.oldfuncint_.declarator_);
visitListDec(_p_->u.oldfuncint_.listdec_);
visitCompound_stm(_p_->u.oldfuncint_.compound_stm_);
break; case is_NewFuncInt:
/* Code for NewFuncInt Goes Here */
visitDeclarator(_p_->u.newfuncint_.declarator_);
visitCompound_stm(_p_->u.newfuncint_.compound_stm_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Function_def!\n");
exit(1);
}
}
void visitDec(Dec _p_)
{
switch(_p_->kind)
{
case is_NoDeclarator:
/* Code for NoDeclarator Goes Here */
visitListDeclaration_specifier(_p_->u.nodeclarator_.listdeclaration_specifier_);
break; case is_Declarators:
/* Code for Declarators Goes Here */
visitListDeclaration_specifier(_p_->u.declarators_.listdeclaration_specifier_);
visitListInit_declarator(_p_->u.declarators_.listinit_declarator_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Dec!\n");
exit(1);
}
}
void visitListDec(ListDec listdec)
{
while(listdec != 0)
{
/* Code For ListDec Goes Here */
visitDec(listdec->dec_);
listdec = listdec->listdec_;
}
}
void visitListDeclaration_specifier(ListDeclaration_specifier listdeclaration_specifier)
{
while(listdeclaration_specifier != 0)
{
/* Code For ListDeclaration_specifier Goes Here */
visitDeclaration_specifier(listdeclaration_specifier->declaration_specifier_);
listdeclaration_specifier = listdeclaration_specifier->listdeclaration_specifier_;
}
}
void visitListInit_declarator(ListInit_declarator listinit_declarator)
{
while(listinit_declarator != 0)
{
/* Code For ListInit_declarator Goes Here */
visitInit_declarator(listinit_declarator->init_declarator_);
listinit_declarator = listinit_declarator->listinit_declarator_;
}
}
void visitStruct_or_union_spec(Struct_or_union_spec _p_)
{
switch(_p_->kind)
{
case is_Tag:
/* Code for Tag Goes Here */
visitStruct_or_union(_p_->u.tag_.struct_or_union_);
visitIdent(_p_->u.tag_.ident_);
visitListStruct_dec(_p_->u.tag_.liststruct_dec_);
break; case is_Unique:
/* Code for Unique Goes Here */
visitStruct_or_union(_p_->u.unique_.struct_or_union_);
visitListStruct_dec(_p_->u.unique_.liststruct_dec_);
break; case is_TagType:
/* Code for TagType Goes Here */
visitStruct_or_union(_p_->u.tagtype_.struct_or_union_);
visitIdent(_p_->u.tagtype_.ident_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Struct_or_union_spec!\n");
exit(1);
}
}
void visitStruct_or_union(Struct_or_union _p_)
{
switch(_p_->kind)
{
case is_Struct:
/* Code for Struct Goes Here */
break; case is_Union:
/* Code for Union Goes Here */
break;
default:
fprintf(stderr, "Error: bad kind field when printing Struct_or_union!\n");
exit(1);
}
}
void visitListStruct_dec(ListStruct_dec liststruct_dec)
{
while(liststruct_dec != 0)
{
/* Code For ListStruct_dec Goes Here */
visitStruct_dec(liststruct_dec->struct_dec_);
liststruct_dec = liststruct_dec->liststruct_dec_;
}
}
void visitStruct_dec(Struct_dec _p_)
{
switch(_p_->kind)
{
case is_Structen:
/* Code for Structen Goes Here */
visitListSpec_qual(_p_->u.structen_.listspec_qual_);
visitListStruct_declarator(_p_->u.structen_.liststruct_declarator_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Struct_dec!\n");
exit(1);
}
}
void visitListSpec_qual(ListSpec_qual listspec_qual)
{
while(listspec_qual != 0)
{
/* Code For ListSpec_qual Goes Here */
visitSpec_qual(listspec_qual->spec_qual_);
listspec_qual = listspec_qual->listspec_qual_;
}
}
void visitSpec_qual(Spec_qual _p_)
{
switch(_p_->kind)
{
case is_TypeSpec:
/* Code for TypeSpec Goes Here */
visitType_specifier(_p_->u.typespec_.type_specifier_);
break; case is_QualSpec:
/* Code for QualSpec Goes Here */
visitType_qualifier(_p_->u.qualspec_.type_qualifier_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Spec_qual!\n");
exit(1);
}
}
void visitListStruct_declarator(ListStruct_declarator liststruct_declarator)
{
while(liststruct_declarator != 0)
{
/* Code For ListStruct_declarator Goes Here */
visitStruct_declarator(liststruct_declarator->struct_declarator_);
liststruct_declarator = liststruct_declarator->liststruct_declarator_;
}
}
void visitStruct_declarator(Struct_declarator _p_)
{
switch(_p_->kind)
{
case is_Decl:
/* Code for Decl Goes Here */
visitDeclarator(_p_->u.decl_.declarator_);
break; case is_Field:
/* Code for Field Goes Here */
visitConstant_expression(_p_->u.field_.constant_expression_);
break; case is_DecField:
/* Code for DecField Goes Here */
visitDeclarator(_p_->u.decfield_.declarator_);
visitConstant_expression(_p_->u.decfield_.constant_expression_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Struct_declarator!\n");
exit(1);
}
}
void visitEnum_specifier(Enum_specifier _p_)
{
switch(_p_->kind)
{
case is_EnumDec:
/* Code for EnumDec Goes Here */
visitListEnumerator(_p_->u.enumdec_.listenumerator_);
break; case is_EnumName:
/* Code for EnumName Goes Here */
visitIdent(_p_->u.enumname_.ident_);
visitListEnumerator(_p_->u.enumname_.listenumerator_);
break; case is_EnumVar:
/* Code for EnumVar Goes Here */
visitIdent(_p_->u.enumvar_.ident_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Enum_specifier!\n");
exit(1);
}
}
void visitListEnumerator(ListEnumerator listenumerator)
{
while(listenumerator != 0)
{
/* Code For ListEnumerator Goes Here */
visitEnumerator(listenumerator->enumerator_);
listenumerator = listenumerator->listenumerator_;
}
}
void visitDeclarator(Declarator _p_)
{
switch(_p_->kind)
{
case is_BeginPointer:
/* Code for BeginPointer Goes Here */
visitPointer(_p_->u.beginpointer_.pointer_);
visitDirect_declarator(_p_->u.beginpointer_.direct_declarator_);
break; case is_NoPointer:
/* Code for NoPointer Goes Here */
visitDirect_declarator(_p_->u.nopointer_.direct_declarator_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Declarator!\n");
exit(1);
}
}
void visitDirect_declarator(Direct_declarator _p_)
{
switch(_p_->kind)
{
case is_Name:
/* Code for Name Goes Here */
visitIdent(_p_->u.name_.ident_);
break; case is_ParenDecl:
/* Code for ParenDecl Goes Here */
visitDeclarator(_p_->u.parendecl_.declarator_);
break; case is_InnitArray:
/* Code for InnitArray Goes Here */
visitDirect_declarator(_p_->u.innitarray_.direct_declarator_);
visitConstant_expression(_p_->u.innitarray_.constant_expression_);
break; case is_Incomplete:
/* Code for Incomplete Goes Here */
visitDirect_declarator(_p_->u.incomplete_.direct_declarator_);
break; case is_NewFuncDec:
/* Code for NewFuncDec Goes Here */
visitDirect_declarator(_p_->u.newfuncdec_.direct_declarator_);
visitParameter_type(_p_->u.newfuncdec_.parameter_type_);
break; case is_OldFuncDef:
/* Code for OldFuncDef Goes Here */
visitDirect_declarator(_p_->u.oldfuncdef_.direct_declarator_);
visitListIdent(_p_->u.oldfuncdef_.listident_);
break; case is_OldFuncDec:
/* Code for OldFuncDec Goes Here */
visitDirect_declarator(_p_->u.oldfuncdec_.direct_declarator_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Direct_declarator!\n");
exit(1);
}
}
void visitPointer(Pointer _p_)
{
switch(_p_->kind)
{
case is_Point:
/* Code for Point Goes Here */
break; case is_PointQual:
/* Code for PointQual Goes Here */
visitListType_qualifier(_p_->u.pointqual_.listtype_qualifier_);
break; case is_PointPoint:
/* Code for PointPoint Goes Here */
visitPointer(_p_->u.pointpoint_.pointer_);
break; case is_PointQualPoint:
/* Code for PointQualPoint Goes Here */
visitListType_qualifier(_p_->u.pointqualpoint_.listtype_qualifier_);
visitPointer(_p_->u.pointqualpoint_.pointer_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Pointer!\n");
exit(1);
}
}
void visitListType_qualifier(ListType_qualifier listtype_qualifier)
{
while(listtype_qualifier != 0)
{
/* Code For ListType_qualifier Goes Here */
visitType_qualifier(listtype_qualifier->type_qualifier_);
listtype_qualifier = listtype_qualifier->listtype_qualifier_;
}
}
void visitParameter_type(Parameter_type _p_)
{
switch(_p_->kind)
{
case is_AllSpec:
/* Code for AllSpec Goes Here */
visitParameter_declarations(_p_->u.allspec_.parameter_declarations_);
break; case is_More:
/* Code for More Goes Here */
visitParameter_declarations(_p_->u.more_.parameter_declarations_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Parameter_type!\n");
exit(1);
}
}
void visitParameter_declarations(Parameter_declarations _p_)
{
switch(_p_->kind)
{
case is_ParamDec:
/* Code for ParamDec Goes Here */
visitParameter_declaration(_p_->u.paramdec_.parameter_declaration_);
break; case is_MoreParamDec:
/* Code for MoreParamDec Goes Here */
visitParameter_declarations(_p_->u.moreparamdec_.parameter_declarations_);
visitParameter_declaration(_p_->u.moreparamdec_.parameter_declaration_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Parameter_declarations!\n");
exit(1);
}
}
void visitParameter_declaration(Parameter_declaration _p_)
{
switch(_p_->kind)
{
case is_OnlyType:
/* Code for OnlyType Goes Here */
visitListDeclaration_specifier(_p_->u.onlytype_.listdeclaration_specifier_);
break; case is_TypeAndParam:
/* Code for TypeAndParam Goes Here */
visitListDeclaration_specifier(_p_->u.typeandparam_.listdeclaration_specifier_);
visitDeclarator(_p_->u.typeandparam_.declarator_);
break; case is_Abstract:
/* Code for Abstract Goes Here */
visitListDeclaration_specifier(_p_->u.abstract_.listdeclaration_specifier_);
visitAbstract_declarator(_p_->u.abstract_.abstract_declarator_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Parameter_declaration!\n");
exit(1);
}
}
void visitListIdent(ListIdent listident)
{
while(listident != 0)
{
/* Code For ListIdent Goes Here */
visitIdent(listident->ident_);
listident = listident->listident_;
}
}
void visitInitializer(Initializer _p_)
{
switch(_p_->kind)
{
case is_InitExpr:
/* Code for InitExpr Goes Here */
visitExp(_p_->u.initexpr_.exp_);
break; case is_InitListOne:
/* Code for InitListOne Goes Here */
visitInitializers(_p_->u.initlistone_.initializers_);
break; case is_InitListTwo:
/* Code for InitListTwo Goes Here */
visitInitializers(_p_->u.initlisttwo_.initializers_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Initializer!\n");
exit(1);
}
}
void visitInitializers(Initializers _p_)
{
switch(_p_->kind)
{
case is_AnInit:
/* Code for AnInit Goes Here */
visitInitializer(_p_->u.aninit_.initializer_);
break; case is_MoreInit:
/* Code for MoreInit Goes Here */
visitInitializers(_p_->u.moreinit_.initializers_);
visitInitializer(_p_->u.moreinit_.initializer_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Initializers!\n");
exit(1);
}
}
void visitType_name(Type_name _p_)
{
switch(_p_->kind)
{
case is_PlainType:
/* Code for PlainType Goes Here */
visitListSpec_qual(_p_->u.plaintype_.listspec_qual_);
break; case is_ExtendedType:
/* Code for ExtendedType Goes Here */
visitListSpec_qual(_p_->u.extendedtype_.listspec_qual_);
visitAbstract_declarator(_p_->u.extendedtype_.abstract_declarator_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Type_name!\n");
exit(1);
}
}
void visitAbstract_declarator(Abstract_declarator _p_)
{
switch(_p_->kind)
{
case is_PointerStart:
/* Code for PointerStart Goes Here */
visitPointer(_p_->u.pointerstart_.pointer_);
break; case is_Advanced:
/* Code for Advanced Goes Here */
visitDir_abs_dec(_p_->u.advanced_.dir_abs_dec_);
break; case is_PointAdvanced:
/* Code for PointAdvanced Goes Here */
visitPointer(_p_->u.pointadvanced_.pointer_);
visitDir_abs_dec(_p_->u.pointadvanced_.dir_abs_dec_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Abstract_declarator!\n");
exit(1);
}
}
void visitDir_abs_dec(Dir_abs_dec _p_)
{
switch(_p_->kind)
{
case is_WithinParentes:
/* Code for WithinParentes Goes Here */
visitAbstract_declarator(_p_->u.withinparentes_.abstract_declarator_);
break; case is_Array:
/* Code for Array Goes Here */
break; case is_InitiatedArray:
/* Code for InitiatedArray Goes Here */
visitConstant_expression(_p_->u.initiatedarray_.constant_expression_);
break; case is_UnInitiated:
/* Code for UnInitiated Goes Here */
visitDir_abs_dec(_p_->u.uninitiated_.dir_abs_dec_);
break; case is_Initiated:
/* Code for Initiated Goes Here */
visitDir_abs_dec(_p_->u.initiated_.dir_abs_dec_);
visitConstant_expression(_p_->u.initiated_.constant_expression_);
break; case is_OldFunction:
/* Code for OldFunction Goes Here */
break; case is_NewFunction:
/* Code for NewFunction Goes Here */
visitParameter_type(_p_->u.newfunction_.parameter_type_);
break; case is_OldFuncExpr:
/* Code for OldFuncExpr Goes Here */
visitDir_abs_dec(_p_->u.oldfuncexpr_.dir_abs_dec_);
break; case is_NewFuncExpr:
/* Code for NewFuncExpr Goes Here */
visitDir_abs_dec(_p_->u.newfuncexpr_.dir_abs_dec_);
visitParameter_type(_p_->u.newfuncexpr_.parameter_type_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Dir_abs_dec!\n");
exit(1);
}
}
void visitStm(Stm _p_)
{
switch(_p_->kind)
{
case is_LabelS:
/* Code for LabelS Goes Here */
visitLabeled_stm(_p_->u.labels_.labeled_stm_);
break; case is_CompS:
/* Code for CompS Goes Here */
visitCompound_stm(_p_->u.comps_.compound_stm_);
break; case is_ExprS:
/* Code for ExprS Goes Here */
visitExpression_stm(_p_->u.exprs_.expression_stm_);
break; case is_SelS:
/* Code for SelS Goes Here */
visitSelection_stm(_p_->u.sels_.selection_stm_);
break; case is_IterS:
/* Code for IterS Goes Here */
visitIter_stm(_p_->u.iters_.iter_stm_);
break; case is_JumpS:
/* Code for JumpS Goes Here */
visitJump_stm(_p_->u.jumps_.jump_stm_);
break;
default:
fprintf(stderr, "Error: bad kind field when printing Stm!\n");
exit(1);
}
}
void visitLabeled_stm(Labeled_stm _p_)