Pull out table to it's own Table class in prep for adding RNGLR algorithm.

This commit is contained in:
Nathan Braswell
2013-07-16 11:15:58 -04:00
parent f84657f1ed
commit 726ead0455
5 changed files with 165 additions and 131 deletions

27
include/Table.h Normal file
View File

@@ -0,0 +1,27 @@
#include "util.h"
#include "ParseRule.h"
#include "ParseAction.h"
#include "Symbol.h"
#include "State.h"
#ifndef TABLE_H
#define TABLE_H
class Table {
public:
Table();
~Table();
void setSymbols(Symbol* EOFSymbol, Symbol* nullSymbol);
void add(int stateNum, Symbol* tranSymbol, ParseAction* action);
ParseAction* get(int state, Symbol* token);
std::string toString();
private:
std::vector< std::vector<ParseAction*>* > table;
std::vector<Symbol*> symbolIndexVec;
//The EOFSymbol, a pointer because of use in table, etc
Symbol* EOFSymbol;
//The nullSymbol, ditto with above. Also used in comparisons
Symbol* nullSymbol;
};
#endif