-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.h
More file actions
62 lines (37 loc) · 1.54 KB
/
Copy pathparser.h
File metadata and controls
62 lines (37 loc) · 1.54 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
/*
Group No: 26
Authors:
Nithin Benny Myppan - 2016A7PS0014P
Adhitya Mamallan - 2016A7PS0028P
Swarup N - 2016A7PS0080P
Naveen Unnikrishnan - 2016A7PS0111P
*/
#ifndef _PARSER_H
#define _PARSER_H
#include "parserDef.h"
#include "stack.h"
#include "NaryTree.h"
Grammar* loadGrammar(char* inputFile);
SymbolNode* makeSymbolNode(int index, bool isTerminal);
int find(char* str, bool isTerminal);
SymbolNode* addToRule(SymbolList* list, SymbolNode* symbolNode, SymbolNode* currentNode);
FirstAndFollow* getFirstAndFollowSets(Grammar* grammar);
void printGrammar(Grammar* grammar);
void computeFirstSet(Grammar* grammar, NonTerminal nonTerminal, bool** first);
void addToSet(bool* set, int index);
bool check(bool *set, int index);
bool setUnion(bool* a, bool* b);
void computeFollowSet(Grammar* grammar, FirstAndFollow* sets);
bool computeFollowUtil(Grammar* grammar, bool** first, bool** follow);
void printFirstAndFollow(FirstAndFollow* sets);
void printSet(bool* set);
ParsingTable makeNewParseTable();
void createParseTable(Grammar* grammar, FirstAndFollow* sets, ParsingTable table);
void printParsingTable(ParsingTable table);
ParseTree parseInputSourceCode(char *testcaseFile, ParsingTable table, FirstAndFollow* ff, int* parseErrors);
void printParseTree(ParseTree tree);
void printParseTree_util(TreeNode* node, FILE** fp1);
void printNode(FILE** fp, TreeNode* node, bool isLeaf, char* empty, char* no, char* yes, char* root);
void printTopOfStack(TreeNode* treeNode);
void printChildren(Children* children);
#endif