Added caching of the RNGLR table. It is automatically regenerated whenever the grammer changes. Right now it has dropped compiling the test file from 30 seconds to less than one second.

This commit is contained in:
Nathan Braswell
2013-12-31 02:53:52 -06:00
parent 3455348951
commit 005659b7b7
6 changed files with 314 additions and 8 deletions

View File

@@ -32,6 +32,8 @@ class Parser {
virtual std::string grammerToDOT();
std::string tableToString();
void exportTable(std::ofstream &file);
void importTable(char* tableData);
protected:
std::vector<Symbol>* firstSet(Symbol token);

View File

@@ -1,3 +1,5 @@
#include <fstream>
#include "util.h"
#include "ParseRule.h"
#include "ParseAction.h"
@@ -11,6 +13,8 @@ class Table {
public:
Table();
~Table();
void exportTable(std::ofstream &file);
void importTable(char* tableData);
void setSymbols(Symbol EOFSymbol, Symbol nullSymbol);
void add(int stateNum, Symbol tranSymbol, ParseAction* action);
void remove(int stateNum, Symbol tranSymbol);