-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParseTree.h
56 lines (38 loc) · 1.14 KB
/
ParseTree.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
// these are the different types of operators that can appear
// in a CNF expression
#define LESS_THAN 1
#define GREATER_THAN 2
#define EQUALS 3
// these are the types of operands that can appear in a CNF expression
#define DOUBLE 1
#define INT 2
#define STRING 3
#define NAME 4
struct Operand {
// this tells us the type of the operand: FLOAT, INT, STRING...
int code;
// this is the actual operand
char *value;
};
struct ComparisonOp {
// this corresponds to one of the codes describing what type
// of literal value we have in this nodes: LESS_THAN, EQUALS...
int code;
// these are the operands on the left and on the right
struct Operand *left;
struct Operand *right;
};
struct OrList {
// this is the comparison to the left of the OR
struct ComparisonOp *left;
// this is the OrList to the right of the OR; again,
// this might be NULL if the right is a simple comparison
struct OrList *rightOr;
};
struct AndList {
// this is the disjunction to the left of the AND
struct OrList *left;
// this is the AndList to the right of the AND
// note that this can be NULL if the right is a disjunction
struct AndList *rightAnd;
};