-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastDef.h
More file actions
92 lines (80 loc) · 1.48 KB
/
Copy pathastDef.h
File metadata and controls
92 lines (80 loc) · 1.48 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
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
86
87
88
89
90
91
92
/*
Group No: 26
Authors:
Nithin Benny Myppan - 2016A7PS0014P
Adhitya Mamallan - 2016A7PS0028P
Swarup N - 2016A7PS0080P
Naveen Unnikrishnan - 2016A7PS0111P
*/
#ifndef _AST_DEF_H
#define _AST_DEF_H
#include "NaryTree.h"
#include "symbolTableDef.h"
typedef enum{
PROGRAM,
MAIN,
OTHER_FN,
FN,
PAR_LIST,
STMTS,
TYPE_DEFS,
TYPE_DEF,
FIELD_DEFS,
FIELD_DEF,
MORE_FIELDS,
DECLARATIONS,
DECLARATION,
OTHER_STMTS,
ASSIGNMENT_STMT,
SINGLE_OR_REC_ID,
FUN_CALL_STMT,
ITERATIVE_STMT,
CONDITIONAL_STMT,
ELSE,
IO_STMT_READ,
IO_STMT_WRITE,
ALL_VAR,
ARITHMETIC,
EXP_PRIME,
TERM,
TERM_PRIME,
ALL,
BOOLEAN1,
BOOLEAN2,
BOOLEAN3,
RETURN,
ID_LIST,
RECORD
}astNodeName;
typedef struct astChildren{
struct astNode* head;
int noSiblings;
struct astNode* tail;
}ASTChildren;
typedef struct astNode{
astNodeName label;
bool leaf;
struct astNode* parent;
ASTChildren* children;
struct astNode* next;
Lexical_Unit* lu;
STTreeNode* currentScope;
struct astNode* extend;
Token_type token;
struct _typeList* returnTypes;
struct astNode* callingFunction;
int lineNo;
Val* value;
bool global;
}ASTNode;
typedef ASTNode* AST;
typedef struct _typeList{
struct _typeListNode* head;
struct _typeListNode* tail;
int noSiblings;
}typeList;
typedef struct _typeListNode{
struct _typeListNode* next;
Token_type type;
}typeListNode;
#endif