#pragma once #include #include "List.hpp" #include "Map.hpp" #include "Instructions.hpp" #include "Statements.hpp" #include "Constants.hpp" namespace obj { struct MethodObject; namespace BCgen { struct FunctionDefinition { FunctionDefinition* mPrnt = nullptr; // signature std::string mFunctionId; tp::List mArgsOrder; ConstObjectsPool mConstants; tp::Map mLocals; tp::List mInstructions; FunctionDefinition(const std::string& function_id, tp::Buffer args, FunctionDefinition* prnt); FunctionDefinition() {} void generateByteCode(ByteCode& out); tp::List::Node* inst(Instruction inst); void EvalExpr(Expression* expr); void EvalStatement(Statement* expr); ConstObject* defineLocal(const std::string& id); }; void init(); void deinit(); void Genereate(ByteCode& out, StatementScope* body); bool Compile(MethodObject* obj); }; };