#ifndef RNGLRPARSER_H #define RNGLRPARSER_H #include #include #include #include #include #include #include #include "Parser.h" #include "Symbol.h" #include "GraphStructuredStack.h" #include "util.h" class RNGLRParser: public Parser { public: RNGLRParser(); ~RNGLRParser(); NodeTree* parseInput(std::string inputString); void printReconstructedFrontier(int frontier); private: void reducer(int i); void shifter(int i); void addChildren(NodeTree* parent, std::vector*>* children, NodeTree* nullableParts); void addStates(std::vector< State* >* stateSets, State* state, std::queue* toDo); void addStateReductionsToTable(State* state); bool fullyReducesToNull(ParseRule* rule); bool reducesToNull(ParseRule* rule); bool reducesToNull(ParseRule* rule, std::vector avoidList); bool belongsToFamily(NodeTree* node, std::vector*>* nodes); bool arePacked(std::vector*> nodes); bool isPacked(NodeTree* node); void setPacked(NodeTree* node, bool isPacked); NodeTree* getNullableParts(ParseRule* rule); NodeTree* getNullableParts(ParseRule* rule, std::vector*> avoidList); NodeTree* getNullableParts(Symbol symbol); std::vector*> getPathEdges(std::vector*> path); int findLine(int tokenNum); //Get the line number for a token, used for error reporting std::vector input; GraphStructuredStack gss; //start node, lefthand side of the reduction, reduction length struct Reduction { NodeTree* from; Symbol symbol; int length; NodeTree* nullableParts; NodeTree* label; } ; std::queue toReduce; //Node coming from, state going to std::queue< std::pair*, int> > toShift; std::vector*, int> > SPPFStepNodes; std::vector*> nullableParts; std::map, bool> packedMap; }; #endif