Well, just before I went to bed I fixed the errors in NodeTree and GraphStructuredStack. To tackle RNGLRParser tommrow.

This commit is contained in:
Nathan Braswell
2013-08-08 03:06:28 -04:00
parent 31d7c02ef9
commit 8570b8f641
4 changed files with 15 additions and 11 deletions

View File

@@ -1,7 +1,9 @@
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include "NodeTree.h"
#include "Symbol.h"
#include "util.h"
#ifndef GRAPH_STRUCTURED_STACK
@@ -27,7 +29,7 @@ class GraphStructuredStack {
std::string toString();
private:
std::vector<std::vector<NodeTree<int>*>*> gss;
std::map<std::pair<NodeTree<int>*, NodeTree<int>*>, NodeTree<Symbol*> edges;
std::map< std::pair< NodeTree<int>*, NodeTree<int>* >, NodeTree<Symbol*>* > edges;
};
#endif

View File

@@ -115,7 +115,7 @@ void NodeTree<T>::addChild(NodeTree<T>* child) {
template<class T>
void NodeTree<T>::addChildren(std::vector<NodeTree<T>*>* children) {
for (std::vector<NodeTree<T>*>::size_type i = 0; i < children->size(); i++)
for (typename std::vector<NodeTree<T>*>::size_type i = 0; i < children->size(); i++)
addChild((*children)[i]);
}
@@ -145,7 +145,7 @@ void NodeTree<T>::removeChild(NodeTree<T>* child) {
template<class T>
void NodeTree<T>::clearChildren() {
for (std::vector<T>::size_type i = 0; i < children.size(); i++)
for (typename std::vector<T>::size_type i = 0; i < children.size(); i++)
children[i] = NULL;
children.clear();
}

View File

@@ -3,9 +3,11 @@
#include <iostream>
#include <queue>
#include <map>
#include <vector>
#include <algorithm>
#include "Parser.h"
#include "Symbol.h"
#include "GraphStructuredStack.h"
class RNGLRParser: public Parser {
@@ -45,7 +47,7 @@ class RNGLRParser: public Parser {
int nullablePartsIndex;
NodeTree<Symbol*>* label;
} ;
std::queue<reduction> toReduce;
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;