-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrammar.H
34 lines (30 loc) · 913 Bytes
/
Grammar.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
/****************************************************************
Grammar.H
This is open-source software, governed by the ARTISTIC LICENSE
(see www.opensource.org).
****************************************************************/
#ifndef INCL_Grammar_H
#define INCL_Grammar_H
#include <iostream>
#include "GrammarAlphabet.H"
#include "Production.H"
#include "BOOM/Vector.H"
#include "BOOM/Map.H"
using namespace std;
using namespace BOOM;
class Grammar {
public:
Grammar();
void addProduction(Production *);
int numProductions() const;
Production *getIthProduction(int i);
Vector<Production*> &getProductionsFor(GrammarSymbol *lhs);
GrammarAlphabet &getTerminals();
GrammarAlphabet &getNonterminals();
private:
GrammarAlphabet terminals, nonterminals;
Vector<Production*> productions;
Map< GrammarSymbol* , Vector<Production*> > productionsByLHS;
};
#endif