Move Cephelepod into deprecated_compiler, create captian.sh to handle bootstrapping kraken from backup or from Cephelepod
This commit is contained in:
72
deprecated_compiler/include/CGenerator.h
Normal file
72
deprecated_compiler/include/CGenerator.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#ifndef CGENERATOR_H
|
||||
#define CGENERATOR_H
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <utility>
|
||||
#include <stack>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "CCodeTriple.h"
|
||||
#include "NodeTree.h"
|
||||
#include "ASTData.h"
|
||||
#include "Type.h"
|
||||
// for mapNodesToTypes
|
||||
#include "ASTTransformation.h"
|
||||
|
||||
#include "util.h"
|
||||
#include "Poset.h"
|
||||
|
||||
// Note the use of std::pair to hold two strings - the running string for the header file and the running string for the c file.
|
||||
|
||||
enum ClosureTypeSpecialType { ClosureTypeRegularNone, ClosureFunctionPointerTypeWithoutClosedParam, ClosureFunctionPointerTypeWithClosedParam };
|
||||
|
||||
class CGenerator {
|
||||
public:
|
||||
CGenerator();
|
||||
~CGenerator();
|
||||
int generateCompSet(std::map<std::string, NodeTree<ASTData>*> ASTs, std::string outputName);
|
||||
std::string generateTypeStruct(NodeTree<ASTData>* from);
|
||||
bool isUnderNodeWithType(NodeTree<ASTData>* from, ASTType type);
|
||||
bool isUnderTranslationUnit(NodeTree<ASTData>* from, NodeTree<ASTData>* typeDefinition);
|
||||
NodeTree<ASTData>* highestScope(NodeTree<ASTData>* node);
|
||||
std::pair<std::string, std::string> generateTranslationUnit(std::string name, std::map<std::string, NodeTree<ASTData>*> ASTs);
|
||||
CCodeTriple generate(NodeTree<ASTData>* from, NodeTree<ASTData>* enclosingObject = NULL, bool justFuncName = false, NodeTree<ASTData>* enclosingFunction = NULL);
|
||||
std::string generateAliasChains(std::map<std::string, NodeTree<ASTData>*> ASTs, NodeTree<ASTData>* definition);
|
||||
|
||||
std::string closureStructType(std::set<NodeTree<ASTData>*> closedVariables);
|
||||
std::string ValueTypeToCType(Type *type, std::string, ClosureTypeSpecialType closureSpecial = ClosureTypeRegularNone);
|
||||
std::string ValueTypeToCTypeDecoration(Type *type, ClosureTypeSpecialType closureSpecial = ClosureTypeRegularNone);
|
||||
std::string ValueTypeToCTypeThingHelper(Type *type, std::string ptrStr, ClosureTypeSpecialType closureSpecial);
|
||||
static std::string CifyName(std::string name);
|
||||
static std::string scopePrefix(NodeTree<ASTData>* from);
|
||||
std::string simpleComplexName(std::string simpleName, std::string complexName);
|
||||
std::string prefixIfNeeded(std::string prefix, std::string name);
|
||||
std::string generateObjectMethod(NodeTree<ASTData>* enclosingObject, NodeTree<ASTData>* from, std::string *functionPrototype);
|
||||
NodeTree<ASTData>* getMethodsObjectType(NodeTree<ASTData>* scope, std::string functionName);
|
||||
NodeTree<ASTData>* getMethod(Type* type, std::string method, std::vector<Type> types);
|
||||
bool methodExists(Type* type, std::string method, std::vector<Type> types);
|
||||
std::string generateMethodIfExists(Type* type, std::string method, std::string parameter, std::vector<Type> methodTypes);
|
||||
std::string emitDestructors(std::vector<NodeTree<ASTData>*> possibleDeclarations, NodeTree<ASTData>* enclosingObject);
|
||||
std::string tabs();
|
||||
std::string getID();
|
||||
|
||||
int tabLevel;
|
||||
int id;
|
||||
std::string function_header;
|
||||
std::string generatorString;
|
||||
std::string linkerString;
|
||||
std::string functionTypedefString;
|
||||
std::string functionTypedefStringPre;
|
||||
std::set<std::string> usedNameSet;
|
||||
std::map<std::string, std::string> simpleComplexNameMap;
|
||||
std::map<Type, triple<std::string, std::string, std::string>> functionTypedefMap;
|
||||
std::map<std::set<NodeTree<ASTData>*>, std::string> closureStructMap;
|
||||
std::vector<std::vector<NodeTree<ASTData>*>> distructDoubleStack;
|
||||
std::stack<int> loopDistructStackDepth;
|
||||
std::vector<std::vector<NodeTree<ASTData>*>> deferDoubleStack;
|
||||
std::stack<int> loopDeferStackDepth;
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user