-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.h
44 lines (40 loc) · 1.35 KB
/
parser.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
/*
* COMPILER PROJECT- ERPLAG COMPILER
* CSE - D 2019
* Sahil Garg, Jenit Jain, Amrit Goyal
*/
#ifndef parser
#define parser
#include "parserDef.h"
#include <stdio.h>
#include <stdlib.h>
#endif
//List of functions for Initialising Grammer
char *getLexeme(term t);
char *getNonTerm(non_term t);
char *getToken(term t);
void initParseTable();
void fillFirstRules(gNode n, int idx, Grammar G);
void fillFollowRules(non_term nt, int idx, Grammar G);
void createParseTable(Grammar G);
gNode initGrammarNode(gElement ge, tag t);
Grammar createGrammar();
void printGrammar(Grammar G);
void addFirst(term q, int ind);
void addFollow(term q, int ind);
void dfs(non_term node, Grammar G);
void findFirst(Grammar G);
void findFollow(Grammar G);
//List of functions for parser & ParseTree
pNode returnCurrent(pNode p);
Queue initQueue();
Queue enqueue(pNode q, pNode p);
PTStack pop(PTStack s);
PTStack mergeStack(gHead T, PTStack s);
pNode createParseTreeNode(pNode Parent, tag t, int level);
pNode createNonTerminal(pNode Parent, non_term nt, tag t, int no_of_child, int level);
pNode createTerminal(pNode Parent, term term_1, tag t, int level, tokenInfo* token);
parseTree initParseTree();
parseTree parseInputSourceCode(char * testCaseFile, hashTable h, Grammar G, int print);
void printParseTreeQueue(pNode p);
void printParseTree(char * testCaseFile, hashTable h, Grammar G);