-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbsyn.H
1667 lines (1413 loc) · 30.5 KB
/
Absyn.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
/* File generated by the BNF Converter (bnfc 2.9.4). */
#ifndef ABSYN_HEADER
#define ABSYN_HEADER
#include<string>
#include<vector>
//C++ Abstract Syntax Interface.
/******************** TypeDef Section ********************/
typedef int Integer;
typedef char Char;
typedef double Double;
typedef std::string String;
typedef std::string Ident;
/******************** Forward Declarations ********************/
class Prog;
class TopDef;
class FnDef;
class EVal;
class Arg;
class BType;
class OType;
class AType;
class Type;
class BracketsOpt;
class SBlk;
class CBlk;
class MemItem;
class Memdef;
class CMemdef;
class Blk;
class Stmt;
class Item;
class Expr;
class DimExpr;
class AddOp;
class MulOp;
class RelOp;
class Program;
class Struct;
class TypeDef;
class TypeDefWS;
class Enum;
class Class;
class ClassWE;
class GFuncDef;
class FuncDef;
class EnumValue;
class Argument;
class Int;
class Doub;
class Bool;
class Void;
class ObjT;
class Array;
class BaseType;
class ObjType;
class ArrType;
class BracketsEmpty;
class SBlock;
class CBlock;
class MemberItem;
class MemberDef;
class CVarDef;
class CFuncDef;
class Block;
class Empty;
class BStmt;
class Decl;
class NoInit;
class Init;
class SExp;
class Ass;
class Ret;
class VRet;
class Cond;
class CondElse;
class While;
class ForLoop;
class Ecast;
class ELitNull;
class ELitInt;
class ELitDoub;
class ELitTrue;
class ELitFalse;
class EString;
class EVar;
class EApp;
class ENewObj;
class EArrow;
class Epropety;
class EFunc;
class Dim;
class ENewBArr;
class ENewOArr;
class EAcc;
class EInc;
class EDecr;
class ENeg;
class ENot;
class EMul;
class EAdd;
class ERel;
class EAnd;
class EOr;
class Plus;
class Minus;
class Times;
class Div;
class Mod;
class LTH;
class LE;
class GTH;
class GE;
class EQU;
class NE;
class ListEVal;
class ListArg;
class ListTopDef;
class ListBracketsOpt;
class ListType;
class ListMemItem;
class ListMemdef;
class ListCMemdef;
class ListStmt;
class ListItem;
class ListDimExpr;
class ListExpr;
/******************** Visitor Interfaces ********************/
class Visitor
{
public:
virtual ~Visitor() {}
virtual void visitProg(Prog *p) = 0;
virtual void visitTopDef(TopDef *p) = 0;
virtual void visitFnDef(FnDef *p) = 0;
virtual void visitEVal(EVal *p) = 0;
virtual void visitArg(Arg *p) = 0;
virtual void visitBType(BType *p) = 0;
virtual void visitOType(OType *p) = 0;
virtual void visitAType(AType *p) = 0;
virtual void visitType(Type *p) = 0;
virtual void visitBracketsOpt(BracketsOpt *p) = 0;
virtual void visitSBlk(SBlk *p) = 0;
virtual void visitCBlk(CBlk *p) = 0;
virtual void visitMemItem(MemItem *p) = 0;
virtual void visitMemdef(Memdef *p) = 0;
virtual void visitCMemdef(CMemdef *p) = 0;
virtual void visitBlk(Blk *p) = 0;
virtual void visitStmt(Stmt *p) = 0;
virtual void visitItem(Item *p) = 0;
virtual void visitExpr(Expr *p) = 0;
virtual void visitDimExpr(DimExpr *p) = 0;
virtual void visitAddOp(AddOp *p) = 0;
virtual void visitMulOp(MulOp *p) = 0;
virtual void visitRelOp(RelOp *p) = 0;
virtual void visitProgram(Program *p) = 0;
virtual void visitStruct(Struct *p) = 0;
virtual void visitTypeDef(TypeDef *p) = 0;
virtual void visitTypeDefWS(TypeDefWS *p) = 0;
virtual void visitEnum(Enum *p) = 0;
virtual void visitClass(Class *p) = 0;
virtual void visitClassWE(ClassWE *p) = 0;
virtual void visitGFuncDef(GFuncDef *p) = 0;
virtual void visitFuncDef(FuncDef *p) = 0;
virtual void visitEnumValue(EnumValue *p) = 0;
virtual void visitArgument(Argument *p) = 0;
virtual void visitInt(Int *p) = 0;
virtual void visitDoub(Doub *p) = 0;
virtual void visitBool(Bool *p) = 0;
virtual void visitVoid(Void *p) = 0;
virtual void visitObjT(ObjT *p) = 0;
virtual void visitArray(Array *p) = 0;
virtual void visitBaseType(BaseType *p) = 0;
virtual void visitObjType(ObjType *p) = 0;
virtual void visitArrType(ArrType *p) = 0;
virtual void visitBracketsEmpty(BracketsEmpty *p) = 0;
virtual void visitSBlock(SBlock *p) = 0;
virtual void visitCBlock(CBlock *p) = 0;
virtual void visitMemberItem(MemberItem *p) = 0;
virtual void visitMemberDef(MemberDef *p) = 0;
virtual void visitCVarDef(CVarDef *p) = 0;
virtual void visitCFuncDef(CFuncDef *p) = 0;
virtual void visitBlock(Block *p) = 0;
virtual void visitEmpty(Empty *p) = 0;
virtual void visitBStmt(BStmt *p) = 0;
virtual void visitDecl(Decl *p) = 0;
virtual void visitNoInit(NoInit *p) = 0;
virtual void visitInit(Init *p) = 0;
virtual void visitSExp(SExp *p) = 0;
virtual void visitAss(Ass *p) = 0;
virtual void visitRet(Ret *p) = 0;
virtual void visitVRet(VRet *p) = 0;
virtual void visitCond(Cond *p) = 0;
virtual void visitCondElse(CondElse *p) = 0;
virtual void visitWhile(While *p) = 0;
virtual void visitForLoop(ForLoop *p) = 0;
virtual void visitEcast(Ecast *p) = 0;
virtual void visitELitNull(ELitNull *p) = 0;
virtual void visitELitInt(ELitInt *p) = 0;
virtual void visitELitDoub(ELitDoub *p) = 0;
virtual void visitELitTrue(ELitTrue *p) = 0;
virtual void visitELitFalse(ELitFalse *p) = 0;
virtual void visitEString(EString *p) = 0;
virtual void visitEVar(EVar *p) = 0;
virtual void visitEApp(EApp *p) = 0;
virtual void visitENewObj(ENewObj *p) = 0;
virtual void visitEArrow(EArrow *p) = 0;
virtual void visitEpropety(Epropety *p) = 0;
virtual void visitEFunc(EFunc *p) = 0;
virtual void visitDim(Dim *p) = 0;
virtual void visitENewBArr(ENewBArr *p) = 0;
virtual void visitENewOArr(ENewOArr *p) = 0;
virtual void visitEAcc(EAcc *p) = 0;
virtual void visitEInc(EInc *p) = 0;
virtual void visitEDecr(EDecr *p) = 0;
virtual void visitENeg(ENeg *p) = 0;
virtual void visitENot(ENot *p) = 0;
virtual void visitEMul(EMul *p) = 0;
virtual void visitEAdd(EAdd *p) = 0;
virtual void visitERel(ERel *p) = 0;
virtual void visitEAnd(EAnd *p) = 0;
virtual void visitEOr(EOr *p) = 0;
virtual void visitPlus(Plus *p) = 0;
virtual void visitMinus(Minus *p) = 0;
virtual void visitTimes(Times *p) = 0;
virtual void visitDiv(Div *p) = 0;
virtual void visitMod(Mod *p) = 0;
virtual void visitLTH(LTH *p) = 0;
virtual void visitLE(LE *p) = 0;
virtual void visitGTH(GTH *p) = 0;
virtual void visitGE(GE *p) = 0;
virtual void visitEQU(EQU *p) = 0;
virtual void visitNE(NE *p) = 0;
virtual void visitListEVal(ListEVal *p) = 0;
virtual void visitListArg(ListArg *p) = 0;
virtual void visitListTopDef(ListTopDef *p) = 0;
virtual void visitListBracketsOpt(ListBracketsOpt *p) = 0;
virtual void visitListType(ListType *p) = 0;
virtual void visitListMemItem(ListMemItem *p) = 0;
virtual void visitListMemdef(ListMemdef *p) = 0;
virtual void visitListCMemdef(ListCMemdef *p) = 0;
virtual void visitListStmt(ListStmt *p) = 0;
virtual void visitListItem(ListItem *p) = 0;
virtual void visitListDimExpr(ListDimExpr *p) = 0;
virtual void visitListExpr(ListExpr *p) = 0;
virtual void visitInteger(Integer x) = 0;
virtual void visitChar(Char x) = 0;
virtual void visitDouble(Double x) = 0;
virtual void visitString(String x) = 0;
virtual void visitIdent(Ident x) = 0;
};
class Visitable
{
public:
virtual ~Visitable() {}
virtual void accept(Visitor *v) = 0;
};
/******************** Abstract Syntax Classes ********************/
class Prog : public Visitable
{
public:
virtual Prog *clone() const = 0;
};
class TopDef : public Visitable
{
public:
virtual TopDef *clone() const = 0;
};
class FnDef : public Visitable
{
public:
virtual FnDef *clone() const = 0;
};
class EVal : public Visitable
{
public:
virtual EVal *clone() const = 0;
};
class Arg : public Visitable
{
public:
virtual Arg *clone() const = 0;
};
class BType : public Visitable
{
public:
virtual BType *clone() const = 0;
};
class OType : public Visitable
{
public:
virtual OType *clone() const = 0;
};
class AType : public Visitable
{
public:
virtual AType *clone() const = 0;
};
class Type : public Visitable
{
public:
virtual Type *clone() const = 0;
};
class BracketsOpt : public Visitable
{
public:
virtual BracketsOpt *clone() const = 0;
};
class SBlk : public Visitable
{
public:
virtual SBlk *clone() const = 0;
};
class CBlk : public Visitable
{
public:
virtual CBlk *clone() const = 0;
};
class MemItem : public Visitable
{
public:
virtual MemItem *clone() const = 0;
};
class Memdef : public Visitable
{
public:
virtual Memdef *clone() const = 0;
};
class CMemdef : public Visitable
{
public:
virtual CMemdef *clone() const = 0;
};
class Blk : public Visitable
{
public:
virtual Blk *clone() const = 0;
};
class Stmt : public Visitable
{
public:
virtual Stmt *clone() const = 0;
};
class Item : public Visitable
{
public:
virtual Item *clone() const = 0;
};
class Expr : public Visitable
{
public:
virtual Expr *clone() const = 0;
};
class DimExpr : public Visitable
{
public:
virtual DimExpr *clone() const = 0;
};
class AddOp : public Visitable
{
public:
virtual AddOp *clone() const = 0;
};
class MulOp : public Visitable
{
public:
virtual MulOp *clone() const = 0;
};
class RelOp : public Visitable
{
public:
virtual RelOp *clone() const = 0;
};
class Program : public Prog
{
public:
ListTopDef *listtopdef_;
Program(const Program &);
Program &operator=(const Program &);
Program(ListTopDef *p1);
~Program();
virtual void accept(Visitor *v);
virtual Program *clone() const;
void swap(Program &);
};
class Struct : public TopDef
{
public:
Ident ident_;
SBlk *sblk_;
Struct(const Struct &);
Struct &operator=(const Struct &);
Struct(Ident p1, SBlk *p2);
~Struct();
virtual void accept(Visitor *v);
virtual Struct *clone() const;
void swap(Struct &);
};
class TypeDef : public TopDef
{
public:
Ident ident_1;
Ident ident_2;
TypeDef(const TypeDef &);
TypeDef &operator=(const TypeDef &);
TypeDef(Ident p1, Ident p2);
~TypeDef();
virtual void accept(Visitor *v);
virtual TypeDef *clone() const;
void swap(TypeDef &);
};
class TypeDefWS : public TopDef
{
public:
Ident ident_1;
SBlk *sblk_;
Ident ident_2;
TypeDefWS(const TypeDefWS &);
TypeDefWS &operator=(const TypeDefWS &);
TypeDefWS(Ident p1, SBlk *p2, Ident p3);
~TypeDefWS();
virtual void accept(Visitor *v);
virtual TypeDefWS *clone() const;
void swap(TypeDefWS &);
};
class Enum : public TopDef
{
public:
Ident ident_;
ListEVal *listeval_;
Enum(const Enum &);
Enum &operator=(const Enum &);
Enum(Ident p1, ListEVal *p2);
~Enum();
virtual void accept(Visitor *v);
virtual Enum *clone() const;
void swap(Enum &);
};
class Class : public TopDef
{
public:
Ident ident_;
CBlk *cblk_;
Class(const Class &);
Class &operator=(const Class &);
Class(Ident p1, CBlk *p2);
~Class();
virtual void accept(Visitor *v);
virtual Class *clone() const;
void swap(Class &);
};
class ClassWE : public TopDef
{
public:
Ident ident_1;
Ident ident_2;
CBlk *cblk_;
ClassWE(const ClassWE &);
ClassWE &operator=(const ClassWE &);
ClassWE(Ident p1, Ident p2, CBlk *p3);
~ClassWE();
virtual void accept(Visitor *v);
virtual ClassWE *clone() const;
void swap(ClassWE &);
};
class GFuncDef : public TopDef
{
public:
FnDef *fndef_;
GFuncDef(const GFuncDef &);
GFuncDef &operator=(const GFuncDef &);
GFuncDef(FnDef *p1);
~GFuncDef();
virtual void accept(Visitor *v);
virtual GFuncDef *clone() const;
void swap(GFuncDef &);
};
class FuncDef : public FnDef
{
public:
Type *type_;
Ident ident_;
ListArg *listarg_;
Blk *blk_;
FuncDef(const FuncDef &);
FuncDef &operator=(const FuncDef &);
FuncDef(Type *p1, Ident p2, ListArg *p3, Blk *p4);
~FuncDef();
virtual void accept(Visitor *v);
virtual FuncDef *clone() const;
void swap(FuncDef &);
};
class EnumValue : public EVal
{
public:
Ident ident_;
EnumValue(const EnumValue &);
EnumValue &operator=(const EnumValue &);
EnumValue(Ident p1);
~EnumValue();
virtual void accept(Visitor *v);
virtual EnumValue *clone() const;
void swap(EnumValue &);
};
class Argument : public Arg
{
public:
Type *type_;
Ident ident_;
Argument(const Argument &);
Argument &operator=(const Argument &);
Argument(Type *p1, Ident p2);
~Argument();
virtual void accept(Visitor *v);
virtual Argument *clone() const;
void swap(Argument &);
};
class Int : public BType
{
public:
Int(const Int &);
Int &operator=(const Int &);
Int();
~Int();
virtual void accept(Visitor *v);
virtual Int *clone() const;
void swap(Int &);
};
class Doub : public BType
{
public:
Doub(const Doub &);
Doub &operator=(const Doub &);
Doub();
~Doub();
virtual void accept(Visitor *v);
virtual Doub *clone() const;
void swap(Doub &);
};
class Bool : public BType
{
public:
Bool(const Bool &);
Bool &operator=(const Bool &);
Bool();
~Bool();
virtual void accept(Visitor *v);
virtual Bool *clone() const;
void swap(Bool &);
};
class Void : public BType
{
public:
Void(const Void &);
Void &operator=(const Void &);
Void();
~Void();
virtual void accept(Visitor *v);
virtual Void *clone() const;
void swap(Void &);
};
class ObjT : public OType
{
public:
Ident ident_;
ObjT(const ObjT &);
ObjT &operator=(const ObjT &);
ObjT(Ident p1);
~ObjT();
virtual void accept(Visitor *v);
virtual ObjT *clone() const;
void swap(ObjT &);
};
class Array : public AType
{
public:
Type *type_;
BracketsOpt *bracketsopt_;
Array(const Array &);
Array &operator=(const Array &);
Array(Type *p1, BracketsOpt *p2);
~Array();
virtual void accept(Visitor *v);
virtual Array *clone() const;
void swap(Array &);
};
class BaseType : public Type
{
public:
BType *btype_;
BaseType(const BaseType &);
BaseType &operator=(const BaseType &);
BaseType(BType *p1);
~BaseType();
virtual void accept(Visitor *v);
virtual BaseType *clone() const;
void swap(BaseType &);
};
class ObjType : public Type
{
public:
OType *otype_;
ObjType(const ObjType &);
ObjType &operator=(const ObjType &);
ObjType(OType *p1);
~ObjType();
virtual void accept(Visitor *v);
virtual ObjType *clone() const;
void swap(ObjType &);
};
class ArrType : public Type
{
public:
AType *atype_;
ArrType(const ArrType &);
ArrType &operator=(const ArrType &);
ArrType(AType *p1);
~ArrType();
virtual void accept(Visitor *v);
virtual ArrType *clone() const;
void swap(ArrType &);
};
class BracketsEmpty : public BracketsOpt
{
public:
BracketsEmpty(const BracketsEmpty &);
BracketsEmpty &operator=(const BracketsEmpty &);
BracketsEmpty();
~BracketsEmpty();
virtual void accept(Visitor *v);
virtual BracketsEmpty *clone() const;
void swap(BracketsEmpty &);
};
class SBlock : public SBlk
{
public:
ListMemdef *listmemdef_;
SBlock(const SBlock &);
SBlock &operator=(const SBlock &);
SBlock(ListMemdef *p1);
~SBlock();
virtual void accept(Visitor *v);
virtual SBlock *clone() const;
void swap(SBlock &);
};
class CBlock : public CBlk
{
public:
ListCMemdef *listcmemdef_;
CBlock(const CBlock &);
CBlock &operator=(const CBlock &);
CBlock(ListCMemdef *p1);
~CBlock();
virtual void accept(Visitor *v);
virtual CBlock *clone() const;
void swap(CBlock &);
};
class MemberItem : public MemItem
{
public:
Ident ident_;
MemberItem(const MemberItem &);
MemberItem &operator=(const MemberItem &);
MemberItem(Ident p1);
~MemberItem();
virtual void accept(Visitor *v);
virtual MemberItem *clone() const;
void swap(MemberItem &);
};
class MemberDef : public Memdef
{
public:
Type *type_;
ListMemItem *listmemitem_;
MemberDef(const MemberDef &);
MemberDef &operator=(const MemberDef &);
MemberDef(Type *p1, ListMemItem *p2);
~MemberDef();
virtual void accept(Visitor *v);
virtual MemberDef *clone() const;
void swap(MemberDef &);
};
class CVarDef : public CMemdef
{
public:
Memdef *memdef_;
CVarDef(const CVarDef &);
CVarDef &operator=(const CVarDef &);
CVarDef(Memdef *p1);
~CVarDef();
virtual void accept(Visitor *v);
virtual CVarDef *clone() const;
void swap(CVarDef &);
};
class CFuncDef : public CMemdef
{
public:
FnDef *fndef_;
CFuncDef(const CFuncDef &);
CFuncDef &operator=(const CFuncDef &);
CFuncDef(FnDef *p1);
~CFuncDef();
virtual void accept(Visitor *v);
virtual CFuncDef *clone() const;
void swap(CFuncDef &);
};
class Block : public Blk
{
public:
ListStmt *liststmt_;
Block(const Block &);
Block &operator=(const Block &);
Block(ListStmt *p1);
~Block();
virtual void accept(Visitor *v);
virtual Block *clone() const;
void swap(Block &);
};
class Empty : public Stmt
{
public:
Empty(const Empty &);
Empty &operator=(const Empty &);
Empty();
~Empty();
virtual void accept(Visitor *v);
virtual Empty *clone() const;
void swap(Empty &);
};
class BStmt : public Stmt
{
public:
Blk *blk_;
BStmt(const BStmt &);
BStmt &operator=(const BStmt &);
BStmt(Blk *p1);
~BStmt();
virtual void accept(Visitor *v);
virtual BStmt *clone() const;
void swap(BStmt &);
};
class Decl : public Stmt
{
public:
Type *type_;
ListItem *listitem_;
Decl(const Decl &);
Decl &operator=(const Decl &);
Decl(Type *p1, ListItem *p2);
~Decl();
virtual void accept(Visitor *v);
virtual Decl *clone() const;
void swap(Decl &);
};
class SExp : public Stmt
{
public:
Expr *expr_;
SExp(const SExp &);
SExp &operator=(const SExp &);
SExp(Expr *p1);
~SExp();
virtual void accept(Visitor *v);
virtual SExp *clone() const;
void swap(SExp &);
};
class Ass : public Stmt
{
public:
Expr *expr_1;
Expr *expr_2;
Ass(const Ass &);
Ass &operator=(const Ass &);
Ass(Expr *p1, Expr *p2);
~Ass();
virtual void accept(Visitor *v);
virtual Ass *clone() const;
void swap(Ass &);
};
class Ret : public Stmt
{
public:
Expr *expr_;
Ret(const Ret &);
Ret &operator=(const Ret &);
Ret(Expr *p1);
~Ret();
virtual void accept(Visitor *v);
virtual Ret *clone() const;
void swap(Ret &);
};
class VRet : public Stmt
{
public:
VRet(const VRet &);
VRet &operator=(const VRet &);
VRet();
~VRet();
virtual void accept(Visitor *v);
virtual VRet *clone() const;
void swap(VRet &);
};
class Cond : public Stmt
{
public:
Expr *expr_;
Stmt *stmt_;
Cond(const Cond &);
Cond &operator=(const Cond &);
Cond(Expr *p1, Stmt *p2);
~Cond();
virtual void accept(Visitor *v);
virtual Cond *clone() const;
void swap(Cond &);
};
class CondElse : public Stmt
{
public:
Expr *expr_;
Stmt *stmt_1;
Stmt *stmt_2;
CondElse(const CondElse &);
CondElse &operator=(const CondElse &);
CondElse(Expr *p1, Stmt *p2, Stmt *p3);
~CondElse();
virtual void accept(Visitor *v);
virtual CondElse *clone() const;
void swap(CondElse &);
};
class While : public Stmt
{
public:
Expr *expr_;
Stmt *stmt_;
While(const While &);
While &operator=(const While &);
While(Expr *p1, Stmt *p2);
~While();
virtual void accept(Visitor *v);
virtual While *clone() const;
void swap(While &);
};
class ForLoop : public Stmt
{
public:
Type *type_;
Ident ident_;
Expr *expr_;
Stmt *stmt_;
ForLoop(const ForLoop &);
ForLoop &operator=(const ForLoop &);
ForLoop(Type *p1, Ident p2, Expr *p3, Stmt *p4);
~ForLoop();
virtual void accept(Visitor *v);
virtual ForLoop *clone() const;
void swap(ForLoop &);