-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReachableFromStart.H
35 lines (30 loc) · 990 Bytes
/
ReachableFromStart.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
/****************************************************************
ReachableFromStart.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_ReachableFromStart_H
#define INCL_ReachableFromStart_H
#include <iostream>
#include "SCFG.H"
using namespace std;
using namespace BOOM;
class ReachableFromStart {
SCFG &G;
GrammarSymbol *start;
ProductionSet &productions;
GrammarAlphabet &nonterminals;
HashMap<GrammarSymbol,bool> *table;
void init();
bool iterate();
bool addRhsToTable(Vector<GrammarSymbol*> &rhs,
HashMap<GrammarSymbol,bool> *table);
public:
ReachableFromStart(SCFG &G);
~ReachableFromStart();
bool operator[](GrammarSymbol *);
void printOn(ostream &) const;
};
ostream &operator<<(ostream &,const ReachableFromStart &);
#endif