Finished writing first code for turning the RNGLR recognizer into a parser. Doesn't compile yet, needs lots of bugfixing, but I'm calling it a night.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "Parser.h"
|
||||
#include "GraphStructuredStack.h"
|
||||
|
||||
@@ -24,14 +26,29 @@ class RNGLRParser: public Parser {
|
||||
bool belongsToFamily(NodeTree<Symbol*>* node, std::vector<NodeTree<Symbol*>*>* nodes);
|
||||
bool arePacked(std::vector<NodeTree<Symbol*>*>* nodes);
|
||||
bool isPacked(NodeTree<Symbol*>* node);
|
||||
void setPacked(NodeTree<Symbol*>* node, bool isPacked)
|
||||
void setPacked(NodeTree<Symbol*>* node, bool isPacked);
|
||||
|
||||
int getNullableIndex(ParseRule* rule);
|
||||
NodeTree<Symbol*> getNullableParts(ParseRule* rule);
|
||||
NodeTree<Symbol*> getNullableParts(Symbol* symbol);
|
||||
NodeTree<Symbol*> getNullableParts(int index);
|
||||
|
||||
std::vector<NodeTree<Symbol*>*> getPathEdges(std::vector<NodeTree<int>*> path);
|
||||
|
||||
std::vector<Symbol*> input;
|
||||
GraphStructuredStack gss;
|
||||
//start node, lefthand side of the reduction, reduction length
|
||||
std::queue<std::pair< std::pair<NodeTree<int>*, Symbol*>, int > > toReduce;
|
||||
struct Reduction {
|
||||
NodeTree<int>* from;
|
||||
Symbol* symbol;
|
||||
int length;
|
||||
int nullablePartsIndex;
|
||||
NodeTree<Symbol*>* label;
|
||||
} ;
|
||||
std::queue<reduction> toReduce;
|
||||
//Node coming from, state going to
|
||||
std::queue< std::pair<NodeTree<int>*, int> > toShift;
|
||||
std::vector<std::pair<NodeTree<Symbol*>*, int> > SPPFStepNodes;
|
||||
|
||||
std::vector<NodeTree<Symbol*>*> nullableParts;
|
||||
std::map<NodeTree<Symbol*>*, bool> packedMap;
|
||||
|
||||
Reference in New Issue
Block a user