-
Notifications
You must be signed in to change notification settings - Fork 0
/
AST.cpp
64 lines (49 loc) · 1.34 KB
/
AST.cpp
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
#include <string>
#include <iostream>
#include "AST.hpp"
using namespace std;
ast::ASTNode::ASTNode() {
this->left = NULL;
this->right = NULL;
}
ast::ASTNode_AddExpr::ASTNode_AddExpr(bool isAddition) {
this->isAddition = isAddition;
this->type = ast::Type::ADD_EXPR;
}
ast::ASTNode_MulExpr::ASTNode_MulExpr(bool isMultiplication) {
this->isMultiplication = isMultiplication;
this->type = ast::Type::MUL_EXPR;
}
ast::ASTNode_INT::ASTNode_INT(int value) {
this->value = value;
this->type = ast::Type::INT_VAL;
}
ast::ASTNode_FLOAT::ASTNode_FLOAT(float value) {
this->value = value;
this->type = ast::Type::FLOAT_VAL;
}
ast::ASTNode_Identifier::ASTNode_Identifier(string idName) {
this->idName = idName;
this->type = ast::Type::ID_FIER;
}
ast::ASTNode_Assignment::ASTNode_Assignment() {
this->type = ast::Type::ASSIGNMENT;
}
ast::ASTNode_Comparator::ASTNode_Comparator(string comp, string oppo) {
this->type = ast::Type::COMPARATOR;
this->comp = comp;
this->oppo = oppo;
}
ast::ASTNode_Boolean::ASTNode_Boolean(bool isTrue) {
this->type = ast::Type::BOOLEAN;
this->isTrue = true;
}
ast::ASTNode_Function_Call::ASTNode_Function_Call() {
this->type = ast::Type::FUNC_CALL;
}
ast::ASTNode_Expr_List::ASTNode_Expr_List() {
this->type = ast::Type::EXPR_LIST;
}
void ast::ASTNode_Expr_List::add(ASTNode * node) {
this->exprList.push_back(node);
}