Added main loop of parser.
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
#endif
|
||||
|
||||
#include "ParseRule.h"
|
||||
#include "ParseAction.h"
|
||||
#include "Symbol.h"
|
||||
#include "StringReader.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
@@ -20,6 +22,10 @@ class Parser {
|
||||
~Parser();
|
||||
|
||||
void loadGrammer(std::string grammerInputString);
|
||||
int gotoTable(int state, Symbol* token);
|
||||
ParseAction* actionTable(int state, Symbol* token);
|
||||
void parseInput(std::string inputString);
|
||||
|
||||
std::string grammerToString();
|
||||
std::string grammerToDOT();
|
||||
private:
|
||||
@@ -27,6 +33,9 @@ class Parser {
|
||||
std::map<std::string, Symbol*> symbols;
|
||||
std::vector<ParseRule*> loadedGrammer;
|
||||
|
||||
std::stack<int> stateStack;
|
||||
std::stack<Symbol*> symbolStack;
|
||||
|
||||
Symbol* getOrAddSymbol(std::string symbolString, bool isTerminal);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user