Work in progress commit. Working on method operator overloading, fixed c-style block comments.

This commit is contained in:
Nathan Braswell
2014-03-14 15:55:45 -04:00
parent 663b124680
commit 3728a849de
6 changed files with 125 additions and 19 deletions

View File

@@ -20,6 +20,7 @@ class ASTTransformation: public NodeTransformation<Symbol,ASTData> {
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, std::vector<NodeTree<ASTData>*> nodes);
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:

View File

@@ -20,6 +20,7 @@ class CGenerator {
std::string generate(NodeTree<ASTData>* from, NodeTree<ASTData>* enclosingObject = NULL);
static std::string ValueTypeToCType(Type *type);
static std::string ValueTypeToCTypeDecoration(Type *type);
static std::string CifyFunctionName(std::string name);
std::string generateObjectMethod(NodeTree<ASTData>* enclosingObject, NodeTree<ASTData>* from);
std::string generatorString;

View File

@@ -24,4 +24,16 @@ bool contains(std::vector<T> vec, T item) {
return false;
}
template <typename T>
std::vector<T> slice(std::vector<T> vec, int begin, int end) {
std::vector<T> toReturn;
if (begin < 0)
begin += vec.size()+1;
if (end < 0)
end += vec.size()+1;
for (int i = begin; i < end; i++)
toReturn.push_back(vec[i]);
return toReturn;
}
#endif