-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparserDef.h
76 lines (62 loc) · 1.52 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
#ifndef _parserDef
#define _parserDef
#include "lexerDef.h"
/*
extern typedef enum _tag
{
TERMINAL, NON_TERMINAL
} nodeTag ;
extern typedef union _TNT {
token* term ;
tokenID nonTerm ;
} TNT ;
extern typedef struct treeNode
{
nodeTag tag ;
TNT tnt ;
struct treeNode *child ;
struct treeNode *next ;
struct treeNode *parent ;
} treeNode ;
extern typedef struct _stacknode{
int key;
struct _stacknode* next;
} stacknode;
*/
/////////////////////////////////////////////////////////////////////////////////
typedef struct Node{
tokenID key ;
struct Node* next;
}node;
typedef struct locs
{
int ind;
struct locs* next;
}location;
typedef struct Gram_Rule{
int LHS;
node* RHS;
}Rule;
location* init () ;
void populate_hash(int index,int enum_value) ;
tokenID grammarStringToTokenID (char *str) ;
node * initnode(int l) ;
void fillUtilityArray () ;
void recur(node* root) ;
void printrule() ;
void printfirst() ;
void printfollow();
void traverse_grammar() ;
void print_parse_table() ;
void testManualFF() ;
void addUniquely(tokenID target, tokenID insert_it) ;
void addUniquelyFollow(tokenID target, tokenID insert_it) ;
void unionFirst(tokenID target, tokenID source) ;
int containsEpsilon(tokenID id) ;
void printFirstList (tokenID id) ;
void populateFirst (tokenID id) ;
void printFollowSet (tokenID id) ;
void populateFollow (tokenID id) ;
void UnionFollowFirst (tokenID target, tokenID source) ;
void unionFollow(tokenID target, tokenID source) ;
#endif