-
Notifications
You must be signed in to change notification settings - Fork 0
/
parserDef.h
150 lines (139 loc) · 2.02 KB
/
parserDef.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
-- Group Number: 68
-- Name: Akhilesh Sudhakar ID: 2013A7PS173P
-- Name: Shubham Sharma ID: 2013A7PS110P
*/
#ifndef HEADERPARSERDEF
#define HEADERPARSERDEF
#include "lexerDef.h"
typedef struct grammar1 {
int LHS;
int numberOfRHS;
int RHS[10];
} grammar1;
typedef grammar1 grammar[89];
typedef int firstset[50][105];
typedef int followset[50][106];
typedef int parseTable[50][55];
typedef parseTable table;
typedef enum {
program,
mainFunction,
otherFunctions,
function,
input_par,
output_par,
parameter_list,
dataType,
primitiveDatatype,
constructedDatatype,
remaining_list,
stmts,
typeDefinitions,
typeDefinition,
fieldDefinitions,
fieldDefinition,
moreFields,
declarations,
declaration,
global_or_not,
otherStmts,
stmt,
assignmentStmt,
singleOrRecId,
singleOrRecIdPrime,
funCallStmt,
outputParameters,
inputParameters,
iterativeStmt,
conditionalStmt,
elsePart,
ioStmt,
allVar,
arithmeticExpression,
expPrime,
term,
termPrime,
factor,
highPrecedenceOperators,
lowPrecedenceOperators,
all,
temp,
booleanExpression,
var,
logicalOp,
relationalOp,
returnStmt,
optionalReturn,
idList,
more_ids,
TK_ASSIGNOP,
TK_COMMENT,
TK_FIELDID,
TK_ID,
TK_NUM,
TK_RNUM,
TK_FUNID,
TK_RECORDID,
TK_WITH,
TK_PARAMETERS,
TK_END,
TK_WHILE,
TK_INT,
TK_REAL,
TK_TYPE,
TK_MAIN,
TK_GLOBAL,
TK_PARAMETER,
TK_LIST,
TK_SQL,
TK_SQR,
TK_INPUT,
TK_OUTPUT,
TK_SEM,
TK_COLON,
TK_DOT,
TK_COMMA,
TK_ENDWHILE,
TK_OP,
TK_CL,
TK_IF,
TK_THEN,
TK_ENDIF,
TK_READ,
TK_WRITE,
TK_RETURN,
TK_PLUS,
TK_MINUS,
TK_MUL,
TK_DIV,
TK_CALL,
TK_RECORD,
TK_ENDRECORD,
TK_ELSE,
TK_AND,
TK_OR,
TK_NOT,
TK_LT,
TK_LE,
TK_EQ,
TK_GT,
TK_GE,
TK_NE,
TK_EOF,
eps,
TK_ERROR
}IDS;
typedef struct parseTreeNode{
int numChildren;
IDS id;
IDS parentId;
tokenInfo token;
struct parseTreeNode* children;//MAX_CHILDREN
} parseTreeNode;
typedef struct stack_struct{
IDS data;
struct stack_struct* below;
}stack_struct;
typedef parseTreeNode parseTree;
#endif