-
Notifications
You must be signed in to change notification settings - Fork 0
/
TypeVisitor.h
75 lines (69 loc) · 1.85 KB
/
TypeVisitor.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
#ifndef _TYPE_VISITOR_H_
#define _TYPE_VISITOR_H_
class Program;
class MainClass;
class ClassDeclSimple;
class ClassDeclExtends;
class VarDecl;
class MethodDecl;
class Argument;
class ArrayType;
class BoolType;
class IntType;
class IdentifierType;
class BinOpExpression;
class Block;
class If;
class While;
class Print;
class Assign;
class ArrayAssign;
class ArrayLookup;
class ArrayLength;
class Call;
class IntegerLiteral;
class True;
class False;
class IdentifierExp;
class This;
class NewArray;
class NewObject;
class Not;
class Identifier;
#include <string>
using namespace std;
// Type Checker Visitor
class TypeVisitor {
public:
virtual string visit(Program* n) = 0;
virtual string visit(MainClass* n) = 0;
virtual string visit(ClassDeclSimple* n) = 0;
virtual string visit(ClassDeclExtends* n) = 0;
virtual string visit(VarDecl* n) = 0;
virtual string visit(MethodDecl* n) = 0;
virtual string visit(Argument* n) = 0;
virtual string visit(ArrayType* n) = 0;
virtual string visit(BoolType* n) = 0;
virtual string visit(IntType* n) = 0;
virtual string visit(IdentifierType* n) = 0;
virtual string visit(BinOpExpression* n) = 0;
virtual string visit(Block* n) = 0;
virtual string visit(If* n) = 0;
virtual string visit(While* n) = 0;
virtual string visit(Print* n) = 0;
virtual string visit(Assign* n) = 0;
virtual string visit(ArrayAssign* n) = 0;
virtual string visit(ArrayLookup* n) = 0;
virtual string visit(ArrayLength* n) = 0;
virtual string visit(Call* n) = 0;
virtual string visit(IntegerLiteral* n) = 0;
virtual string visit(True* n) = 0;
virtual string visit(False* n) = 0;
virtual string visit(IdentifierExp* n) = 0;
virtual string visit(This* n) = 0;
virtual string visit(NewArray* n) = 0;
virtual string visit(NewObject* n) = 0;
virtual string visit(Not* n) = 0;
virtual string visit(Identifier* n) = 0;
};
#endif