-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSententialForm.H
32 lines (28 loc) · 931 Bytes
/
SententialForm.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
/****************************************************************
SententialForm.H
Copyright (C)2013 William H. Majoros ([email protected]).
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
****************************************************************/
#ifndef INCL_SententialForm_H
#define INCL_SententialForm_H
#include <iostream>
#include "BOOM/Vector.H"
#include "GrammarSymbol.H"
#include "Production.H"
using namespace std;
using namespace BOOM;
class SententialForm {
Vector<GrammarSymbol*> V;
public:
SententialForm();
void append(GrammarSymbol *);
int length();
GrammarSymbol *operator[](int);
bool isFinal() const; // contains no nonterminals
int leftmostNonterminal() const;
void rewrite(int pos,Production *);
void printOn(ostream &os) const;
};
ostream &operator<<(ostream &os,const SententialForm &);
#endif