-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparserDef.h
More file actions
126 lines (105 loc) · 2.8 KB
/
Copy pathparserDef.h
File metadata and controls
126 lines (105 loc) · 2.8 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
Group 8
Rahul Sharma 2013B5A7713P
Srajan Jain 2013B5A7810P
*/
#include "lexerDef.h"
#define no_rules 94
#define no_tnt 109 //+1 not included here, i.e. t_IDF, function parameter.
#define no_terminals 58
#define no_non_terminals (no_tnt-no_terminals)
#define symbol_table_size 101
#define lookup_table_size 101 //for handing duplicate cases in integer switch
#define REAL_SIZE 4 //In bytes
#define INTEGER_SIZE 2
#define BOOLEAN_SIZE 1
#define YES_ARRAY 1
#define NO_ARRAY 0
#define SPECIAL_OFFSET UINT_MAX
//#define indexNonTerm(a) (a-no_terminals)
typedef enum {dt_INTEGER,dt_REAL,dt_BOOLEAN,dt_undec,dt_specialVar} enum_data_type; //specialVar for iterative and condional ids
typedef struct{
enum_data_type type;
int isArray;
int num1,num2;
} st_data_type;
struct _symbolTableEntry{
char symbol[bufferSize];
st_data_type dataType;
unsigned int width;
unsigned int offset; //if value is UINT_MAX, then fetch from parent
struct _symbolTableEntry *next;
int dirtyBit; //used for checking change of return value
};
typedef struct _symbolTableEntry *symbolTableEntry;
struct _scopeInfo{
unsigned int *currOffsetPtr;
int nestingLevel;
struct _scopeInfo *parent;
char moduleName[bufferSize];
symbolTableEntry table[symbol_table_size];
};
typedef struct _scopeInfo* scopeInfo;
typedef struct{
tnt LHS;
tnt *RHS;
int length_RHS;
} rule;
typedef struct{
tnt token;
unsigned long long FIRST;
unsigned long long FOLLOW;
} term_sets;
struct treeNod{
tnt astName;
tnt tokenId;
char lexeme[bufferSize];
unsigned long lineNo;
int visited; //Used for inorder traversal
int ruleUsed;
struct treeNod* leftMostChild;
struct treeNod* nextSibling;
struct treeNod* parent;
scopeInfo scope;
st_data_type dataType;
enum_data_type exprType;
//struct treeNod* parent;
};
typedef struct treeNod* treeNode;
struct Nod{
treeNode data;
struct Nod* next;
};
typedef struct Nod node;
struct _st_data_type_LL{ //It does not actually have datatype directly.
symbolTableEntry entryName;
struct _st_data_type_LL* next;
};
typedef struct _st_data_type_LL* st_data_type_LL;
struct _moduleSymbolTableEntry{
char moduleName[bufferSize];
int no_input;
int no_output;
st_data_type_LL inputDataTypesList;
st_data_type_LL outputDataTypesList;
struct _moduleSymbolTableEntry *next;
};
typedef struct _moduleSymbolTableEntry *moduleSymbolTableEntry;
struct _moduleScopeInfo{
moduleSymbolTableEntry table[symbol_table_size];
};
typedef struct _moduleScopeInfo* moduleScopeInfo;
struct _lookupTableEntry{
int value;
unsigned long lineNo;
struct _lookupTableEntry *next;
};
typedef struct _lookupTableEntry* lookupTableEntry;
typedef struct{
lookupTableEntry lookupTable[lookup_table_size];
}lookupTableStruct;
struct _printListNode{
scopeInfo info;
struct _printListNode *next;
};
typedef struct _printListNode* printListNode;