-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathast.cpp
More file actions
54 lines (46 loc) · 1.29 KB
/
ast.cpp
File metadata and controls
54 lines (46 loc) · 1.29 KB
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
#include "ast.h"
using namespace std;
ASTstmt::ASTstmt(stmt_type type, ASTstmt *body, ASTstmt *tail, string label) {
this->type = type;
this->body = body;
this->tail = tail;
this->label = label;
}
ASTExpr::ASTExpr(char op, ASTlval *operand, int constval, ASTExpr *left,
ASTExpr *right) {
this->op = op;
this->operand = operand;
this->constant_val = constval;
this->left = left;
this->right = right;
}
ASTfcall::ASTfcall(string identifier) {
this->identifier = identifier;
parameters = new vector<ASTExpr *>;
this->nesting_diff = -1;
}
ASTlval::ASTlval(bool constant, string identifier) {
this->constant = constant;
this->identifier = identifier;
this->indices = new vector<ASTExpr *>();
}
ASTfdef::ASTfdef(ASTheader *header, ASTstmt *body) {
this->header = header;
this->body = body;
}
ASTheader::ASTheader(Type type, ASTparam *list, string identifier) {
this->identifier = identifier;
this->type = type;
this->paramlist = list;
}
ASTparam::ASTparam(vector<string> *id, Type p, ASTparam *next) {
this->identifiers = id;
this->p = p;
this->byref = 0;
this->next = next;
}
ASTif::ASTif(ASTExpr *condition, ASTstmt *body) {
this->tail = NULL;
this->condition = condition;
this->body = body;
}