-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProduction.H
42 lines (37 loc) · 1.04 KB
/
Production.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
/****************************************************************
Production.H
This is open-source software, governed by the ARTISTIC LICENSE
(see www.opensource.org).
****************************************************************/
#ifndef INCL_Production_H
#define INCL_Production_H
#include <iostream>
#include "GrammarSymbol.H"
#include "BOOM/Vector.H"
using namespace std;
using namespace BOOM;
class Production {
public:
Production();
GrammarSymbol *getLHS() const;
void setLHS(GrammarSymbol *);
Vector<GrammarSymbol*> &getRHS();
int rhsLength() const;
float getProbability() const;
void setProbability(float);
bool isInCNF() const;
void printOn(ostream &) const;
bool isNull() const;
bool isTerminal() const;
bool isTerminalOrNull() const;
bool containsAnyTerminals() const;
bool containsAnyNonterminals() const;
bool operator==(const Production &) const;
private:
GrammarSymbol *lhs;
Vector<GrammarSymbol*> rhs;
float P;
};
ostream &operator<<(ostream &,const Production &);
#endif