-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparserDef.h
More file actions
115 lines (101 loc) · 2.05 KB
/
Copy pathparserDef.h
File metadata and controls
115 lines (101 loc) · 2.05 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
/*
Group No: 26
Authors:
Nithin Benny Myppan - 2016A7PS0014P
Adhitya Mamallan - 2016A7PS0028P
Swarup N - 2016A7PS0080P
Naveen Unnikrishnan - 2016A7PS0111P
*/
#ifndef _PARSER_DEF_H
#define _PARSER_DEF_H
#include <stdbool.h>
#include "lexerDef.h"
#define NON_TERMINAL_COUNT 51
#define TERMINAL_COUNT 56
#define SYMBOL_SIZE 25
typedef Token_type Terminal;
typedef enum{
program,
otherFunctions,
mainFunction,
stmts,
stmt,
function,
input_par,
output_par,
parameter_list,
dataType,
remaining_list,
primitiveDatatype,
constructedDatatype,
typeDefinitions,
typeDefinition,
declarations,
declaration,
otherStmts,
returnStmt,
fieldDefinitions,
fieldDefinition,
moreFields,
global_or_not,
assignmentStmt,
iterativeStmt,
conditionalStmt,
ioStmt,
funCallStmt,
singleOrRecId,
arithmeticExpression,
new_24,
outputParameters,
inputParameters,
idList,
booleanExpression,
elsePart,
allVar,
allVar_1,
var,
term,
expPrime,
lowPrecedenceOperators,
factor,
termPrime,
highPrecedenceOperators,
all,
temp,
logicalOp,
relationalOp,
optionalReturn,
more_ids
}NonTerminal;
typedef union{
Terminal term;
NonTerminal nonterm;
}Symbol;
typedef struct _symbolNode{
Symbol symbol;
bool isTerminal;
struct _symbolNode* next;
}SymbolNode;
typedef struct _symbolList{
SymbolNode* head;
int length;
}SymbolList;
typedef struct _rule{
SymbolList* symbols;
struct _rule* next;
int ruleNo;
}Rule;
typedef struct _rules{
Rule* head;
int ruleCount;
}Rules;
typedef struct _grammar{
int ruleCount;
Rules** rules;
}Grammar;
typedef struct _firstAndFollow{
bool** first;
bool** follow;
}FirstAndFollow;
typedef Rule*** ParsingTable;
#endif