Just got paranoid about saving all this work. Almost finished operator overloading, but everything is slightly broken right now.

This commit is contained in:
Nathan Braswell
2014-03-06 13:13:40 -05:00
parent 7f902880c5
commit 57976beb40
15 changed files with 273 additions and 147 deletions

View File

@@ -10,7 +10,7 @@ class Type;
#include "Type.h"
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
enum ASTType {undef, translation_unit, interpreter_directive, import, identifier, type_def,
@@ -29,7 +29,7 @@ class ASTData {
ASTType type;
Type* valueType;
Symbol symbol;
std::map<std::string, NodeTree<ASTData>*> scope;
std::map<std::string, std::vector<NodeTree<ASTData>*>> scope;
private:
};

View File

@@ -16,12 +16,15 @@ class ASTTransformation: public NodeTransformation<Symbol,ASTData> {
ASTTransformation(Importer* importerIn);
~ASTTransformation();
virtual NodeTree<ASTData>* transform(NodeTree<Symbol>* from);
NodeTree<ASTData>* transform(NodeTree<Symbol>* from, NodeTree<ASTData>* scope);
NodeTree<ASTData>* transform(NodeTree<Symbol>* from, NodeTree<ASTData>* scope, std::vector<Type> types = std::vector<Type>());
std::vector<NodeTree<ASTData>*> transformChildren(std::vector<NodeTree<Symbol>*> children, std::set<int> skipChildren, NodeTree<ASTData>* scope, std::vector<Type> types);
std::vector<Type> mapNodesToTypes(std::vector<NodeTree<ASTData>*> nodes);
std::string concatSymbolTree(NodeTree<Symbol>* root);
NodeTree<ASTData>* scopeLookup(NodeTree<ASTData>* scope, std::string lookup);
NodeTree<ASTData>* scopeLookup(NodeTree<ASTData>* scope, std::string lookup, std::vector<Type> types = std::vector<Type>());
Type* typeFromString(std::string type, NodeTree<ASTData>* scope);
private:
Importer * importer;
std::map<std::string, std::vector<NodeTree<ASTData>*>> languageLevelScope;
};
#endif

View File

@@ -19,6 +19,7 @@ class CGenerator {
void generateCompSet(std::map<std::string, NodeTree<ASTData>*> ASTs, std::string outputName);
std::string generate(NodeTree<ASTData>* from, NodeTree<ASTData>* enclosingObject = NULL);
static std::string ValueTypeToCType(Type *type);
static std::string ValueTypeToCTypeDecoration(Type *type);
std::string generateObjectMethod(NodeTree<ASTData>* enclosingObject, NodeTree<ASTData>* from);
std::string generatorString;

View File

@@ -4,7 +4,7 @@
#include "NodeTree.h"
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
template <class FROM, class TO>

View File

@@ -2,7 +2,7 @@
#define NODETREE_H
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#include <vector>

View File

@@ -2,7 +2,7 @@
#define PARSE_ACTION_H
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#include "util.h"

View File

@@ -2,7 +2,7 @@
#define PARSERULE_H
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#include "Symbol.h"

View File

@@ -2,7 +2,7 @@
#define STATE_H
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#include "util.h"

View File

@@ -2,7 +2,7 @@
#define SYMBOL_H
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#include "NodeTree.h"

View File

@@ -2,7 +2,7 @@
#define TYPE_H
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#include <string>
@@ -25,6 +25,8 @@ class Type {
Type(NodeTree<ASTData>* typeDefinitionIn, int indirectionIn);
Type(ValueType typeIn, NodeTree<ASTData>* typeDefinitionIn, int indirectionIn);
~Type();
bool const operator==(const Type &other)const;
bool const operator!=(const Type &other)const;
std::string toString();
ValueType baseType;
NodeTree<ASTData>* typeDefinition;

View File

@@ -2,7 +2,7 @@
#define UTIL_H
#ifndef NULL
#define NULL 0
#define NULL ((void*)0)
#endif
#include <iostream>