Cleaned up some debug messages, parseInput(string) now returns a parse tree of NodeTree*. This is done by having each non-terminal Symbol have it's own subtree and calling a method to combine subtrees and terminals on each reduce. The output is now the DOT version of the parse tree.

This commit is contained in:
Nathan Braswell
2013-05-30 19:49:19 -04:00
parent dd7b255520
commit 0c4af245bf
5 changed files with 85 additions and 28 deletions

View File

@@ -5,18 +5,26 @@
#define NULL 0
#endif
#include "NodeTree.h"
#include <vector>
#include <string>
class Symbol {
public:
Symbol(std::string name, bool isTerminal);
Symbol(std::string name, bool isTerminal, NodeTree* tree);
~Symbol();
bool const operator==(const Symbol &other);
std::string toString();
Symbol* clone();
void setSubTree(NodeTree* tree);
NodeTree* getSubTree();
bool isTerminal();
private:
std::string name;
bool isTerminal;
bool terminal;
NodeTree* subTree;
};