-
Notifications
You must be signed in to change notification settings - Fork 0
/
element_desc.h
85 lines (78 loc) · 1.23 KB
/
element_desc.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
#ifndef element_desc_h
#define element_desc_h
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef enum {
SUM,
SUB,
MULTIPLY,
DIVIDE,
EQUAL,
DIFFERENT,
MINOR,
MORE,
NEGATIVE,
REST,
NEGATE,
AND,
OR,
CONDITIONAL,
LESS_EQUAL,
GREATER_EQUAL
} Operator;
typedef enum {
VAR_EMPTY,
VAR_INTEGER,
VAR_ERROR,
VAR_CHAR,
VAR_STRING
} VarType;
typedef enum {
ASSIGN,
IDENTIFIER,
STATEMENT,
ID_ARRAY,
IF,
ELSE,
WHILE,
UNARY,
BINARY,
TERNARY,
BLOCK,
DECLARATION,
FUNC_DECLARATION,
FUNC_CALL,
VARIABLE,
ARRAY_VARIABLE,
LIST_VARIABLE,
INTEGER,
CHAR,
STRING,
NEW_LINE,
READ,
WRITE,
START,
EMPTY,
RETURN,
EXPRESSION,
EXPRESSION_LIST
} NodeType;
struct Element {
vector<Element*> list;
int lineNum, intValue, level;
char charValue;
string* name;
Operator operatorType;
NodeType nodeType;
VarType varType;
Element* id;
//constructor
Element()
{
name = new string("");
intValue = -1;
}
};
#endif