-
Notifications
You must be signed in to change notification settings - Fork 0
/
exp.h
175 lines (147 loc) · 2.66 KB
/
exp.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
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include "quilt.h"
#include "quadruple.h"
#include "symtab.h"
using namespace std;
class Exp_Node {
public:
Quilt q;
Quadruple *quadruple;
int tempNumber;
Exp_Node();
Exp_Node(const Exp_Node &);
virtual void print() = 0;
virtual void evaluate() = 0;
void printMatrix();
void generateCPPCode();
void printSpaces(int spaces);
};
class A_AST: public Exp_Node {
public:
A_AST();
void print();
void evaluate();
};
class B_AST: public Exp_Node {
public:
B_AST();
void print();
void evaluate();
};
class TURN_AST: public Exp_Node {
protected:
Exp_Node *child;
public:
TURN_AST(Exp_Node *c);
void print();
void evaluate();
};
class SEW_AST: public Exp_Node {
protected:
Exp_Node *left;
Exp_Node *right;
public:
SEW_AST(Exp_Node *l, Exp_Node *r);
void print();
void evaluate();
};
class HDROW_AST: public Exp_Node {
protected:
Exp_Node *child;
public:
HDROW_AST(Exp_Node *c);
void print();
void evaluate();
};
class TLROW_AST: public Exp_Node {
protected:
Exp_Node *child;
public:
TLROW_AST(Exp_Node *c);
void print();
void evaluate();
};
class HDCOL_AST: public Exp_Node {
protected:
Exp_Node *child;
public:
HDCOL_AST(Exp_Node *c);
void print();
void evaluate();
};
class TLCOL_AST: public Exp_Node {
protected:
Exp_Node *child;
public:
TLCOL_AST(Exp_Node *c);
void print();
void evaluate();
};
class LET_AST: public Exp_Node {
Exp_Node *decls;
Exp_Node *exprs;
public:
LET_AST(Exp_Node *decls, Exp_Node *exprs);
void print();
void evaluate();
};
class CALL_AST: public Exp_Node {
SymEntry *symEntry;
int symEntryIndex;
Exp_Node *actuals;
Exp_Node *funcExpr;
public:
CALL_AST(SymEntry *symEntry, int symEntryIndex, Exp_Node *actuals, Exp_Node *funcExpr);
void print();
void evaluate();
};
class DECLS_AST: public Exp_Node {
Exp_Node *child1;
Exp_Node *child2;
public:
DECLS_AST(Exp_Node *child1, Exp_Node *child2);
void print();
void evaluate();
};
class FUN_AST: public Exp_Node {
public:
char *name;
Exp_Node *formals;
Exp_Node *expr;
FUN_AST();
FUN_AST(char *name, Exp_Node *formals, Exp_Node *expr);
void print();
void evaluate();
};
class VAL_AST: public Exp_Node {
char *name;
Exp_Node *expr;
public:
VAL_AST(char *name, Exp_Node *expr);
void print();
void evaluate();
};
class FORMAL_AST: public Exp_Node {
char *name;
Exp_Node *child;
bool lastParam;
public:
FORMAL_AST(char *name, Exp_Node *child, bool lastParam);
void print();
void evaluate();
};
class ACTUALS_AST: public Exp_Node {
public:
Exp_Node *expr;
Exp_Node *actuals;
vector<Exp_Node *> actualArguments;
bool formalParams;
ACTUALS_AST(Exp_Node *expr, Exp_Node *actuals, bool formalParams);
void print();
void evaluate();
};