-
Notifications
You must be signed in to change notification settings - Fork 7
/
parser.h
56 lines (51 loc) · 1.68 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
45
46
47
48
49
50
51
52
53
54
55
56
/*
GROUP NUMBER: 11
NIKKI GUPTA 2016A7PS0057P
SAHIL RANADIVE 2016A7PS0097P
ADITI AGARWAL 2016A7PS0095P
ADITYA LADDHA 2016A7PS0038P
*/
#ifndef PARSER
#define PARSER
#include "parserDef.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int hashcode(char* string);
hashtable createHashTable();
void insertToHash(helement e,hashtable ht);
helement searchInTable(hashtable ht,char* string);
helement createHashElement(char* string);
node* readGrammar(char* filename,hashtable ht);
void getFirst(hashtable ht,char* firstfile);
void getFollow(hashtable ht,char* followfile);
void printrule(node ls);
void printRuleNo(helement h);
int hashFun(char* string );
char* getCorrespondingString(int f);
int getRowIndex(char* s);
int getColumnIndex(char* s);
node getFirstAlpha(node rule, hashtable ht);
parseTable createParseTable(hashtable ht,node* grules);
void mergeLists(node list1,node list2);
int epsinFirst(node nonterminal,hashtable ht);
stack createStack();
void push(stack s, int rule_no, char* a);
int getTop(stack s);
int pop(stack s, char* a);
int isEmpty(stack s);
treenode createTreeNode(char *lexeme, int id, char* a);
int isFollow(int X, int ip,hashtable ht);
void printStack(stack s);
treenode parseInputSourceCode(FILE* fp, parseTable pTable, node* gRules, tokenInfo token, char*buffer, int bsize, hashtable ht,int* error);
treenode addChildrenRule(treenode parent, node gListHead, int line, char* lexeme);
int getId(char* str);
void printInorderTraversal(treenode tree,char* outputFileName);
void inorder(treenode tree,FILE* fp);
void printParseTree(treenode pTree);
void printTree(treenode t);
int getPTreeSize();
int getParsingErrors();
void resetParserError();
int countNodes(treenode root);
#endif