-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgrammar.h
More file actions
38 lines (30 loc) · 736 Bytes
/
grammar.h
File metadata and controls
38 lines (30 loc) · 736 Bytes
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
/*
BATCH NO. 27
Mayank Agarwal (2014A7PS111P)
Karan Deep Batra(2014A7PS160P)
*/
#ifndef _grammar_h_
#define _grammar_h_
#include "ntort.h"
#include "hashtable.h"
#define maxnonterminals 50
//node stores the antecedent of a rule in the grammar
typedef struct node node;
struct node
{
node* next;
ntort* firstntort;//pointer to first ntort in node
ntort* lastntort; //pointer to last ntort in node
};
node* grammar[maxnonterminals+5];
node toppointers[maxnonterminals+5];
node* makenode();
void populateGrammar(hashtable* table);
void printGrammar(hashtable* table);
void printTopDownGrammar(hashtable* table);
/*
Grammar stored as
<nonterminal> --> node -> node -> ... -> node
node : ntort -> ntort -> .... -> ntort
*/
#endif