Added rough but working scoping.

This commit is contained in:
Nathan Braswell
2013-12-27 13:05:07 -06:00
parent 15674fec2a
commit 98b899b8a9
7 changed files with 170 additions and 53 deletions

View File

@@ -2,7 +2,7 @@
#define ASTDATA_H
#include <vector>
#include <set>
#include <map>
#include "Symbol.h"
#include "Type.h"
@@ -28,6 +28,7 @@ class ASTData {
ASTType type;
Type valueType;
Symbol symbol;
std::map<std::string, NodeTree<ASTData>*> scope;
private:
};

View File

@@ -1,6 +1,9 @@
#ifndef ASTTRANSFORMATION_H
#define ASTTRANSFORMATION_H
#include <set>
#include <map>
#include "ASTData.h"
#include "NodeTransformation.h"
@@ -9,8 +12,9 @@ class ASTTransformation: public NodeTransformation<Symbol,ASTData> {
ASTTransformation();
~ASTTransformation();
virtual NodeTree<ASTData>* transform(NodeTree<Symbol>* from);
NodeTree<ASTData>* transform(NodeTree<Symbol>* from, NodeTree<ASTData>* scope);
std::string concatSymbolTree(NodeTree<Symbol>* root);
NodeTree<ASTData>* scopeLookup(NodeTree<ASTData>* scope, std::string lookup);
private:
//Nothing
};