2013-07-28 19:45:08 -04:00
|
|
|
#include <iostream>
|
2013-07-31 23:51:05 -04:00
|
|
|
#include <queue>
|
|
|
|
|
#include "Parser.h"
|
|
|
|
|
#include "GraphStructuredStack.h"
|
2013-07-28 19:45:08 -04:00
|
|
|
|
2013-07-31 23:51:05 -04:00
|
|
|
class RNGLRParser: public Parser {
|
2013-07-28 19:45:08 -04:00
|
|
|
public:
|
2013-07-31 23:51:05 -04:00
|
|
|
RNGLRParser();
|
|
|
|
|
~RNGLRParser();
|
|
|
|
|
NodeTree<Symbol*>* parseInput(std::string inputString);
|
|
|
|
|
void reducer(int i);
|
|
|
|
|
void shifter(int i);
|
2013-08-02 02:47:01 -04:00
|
|
|
void addStates(std::vector< State* >* stateSets, State* state);
|
2013-08-02 15:21:42 -04:00
|
|
|
bool reducesToNull(ParseRule* rule);
|
|
|
|
|
bool reducesToNull(ParseRule* rule, std::vector<Symbol*> avoidList);
|
2013-07-28 19:45:08 -04:00
|
|
|
private:
|
|
|
|
|
std::vector<Symbol*> input;
|
|
|
|
|
GraphStructuredStack gss;
|
|
|
|
|
//start node, lefthand side of the reduction, reduction length
|
2013-07-31 23:51:05 -04:00
|
|
|
std::queue<std::pair< std::pair<NodeTree<int>*, Symbol*>, int > > toReduce;
|
2013-07-28 19:45:08 -04:00
|
|
|
//Node coming from, state going to
|
2013-07-28 23:48:10 -04:00
|
|
|
std::queue< std::pair<NodeTree<int>*, int> > toShift;
|
2013-07-28 19:45:08 -04:00
|
|
|
};
|