-
Notifications
You must be signed in to change notification settings - Fork 1
/
allNodes.h
79 lines (69 loc) · 1.36 KB
/
allNodes.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
#include <bits/stdc++.h>
using namespace std;
// enum dataTypes
// {
// INT=0,FLOAT,CHAR
// };
// struct simpleSymbolTable
// {
// string var_name;
// string varType;
// int scope;
// };
struct allVariables
{
string var_name;
string varType;
string paramOrVar;
int dimension[10];
int scope;
allVariables()
{
int size = sizeof(dimension) / sizeof(dimension[0]);
for (int i = 0; i < size; ++i)
dimension[i] = 0;
}
};
struct symbolTable
{
string funcName;
string funcReturnType;
std::vector<allVariables> paramListPtr;
std::vector<allVariables> localVariables;
int numParams;
symbolTable()
{
numParams = 0;
funcName = "";
funcReturnType = "void";
}
};
// struct findFuncNameIndex
// {
// string funcName;
// findFuncNameIndex(string funcName) : id(id) {}
// bool operator () ( const monster& m ) const
// {
// return m.id == id;
// }
// };
// it = std::find_if( monsters.begin(), monsters.end(), findFuncNameIndex(monsterID));
struct node
{
node *children[10];
node *parent;
string nodeName;
string nodeValue;
string code;
string childType;
string Operator;
string threeAddrName;
node()
{
for (int i = 0; i < 10; ++i)
{
children[i]= NULL;
}
parent = NULL;
}
};