Objects Initial
This commit is contained in:
parent
00bc875846
commit
803ce23169
76 changed files with 7895 additions and 17 deletions
47
Objects/public/compiler/function.h
Normal file
47
Objects/public/compiler/function.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Strings.hpp"
|
||||
#include "List.hpp"
|
||||
#include "Map.hpp"
|
||||
|
||||
#include "instruction.h"
|
||||
#include "statement.h"
|
||||
#include "constants.h"
|
||||
|
||||
namespace obj {
|
||||
struct MethodObject;
|
||||
|
||||
namespace BCgen {
|
||||
|
||||
struct FunctionDefinition {
|
||||
|
||||
FunctionDefinition* mPrnt = NULL;
|
||||
|
||||
// signature
|
||||
tp::String mFunctionId;
|
||||
tp::List<ConstObject*> mArgsOrder;
|
||||
|
||||
ConstObjectsPool mConstants;
|
||||
tp::Map<tp::String, ConstObject*> mLocals;
|
||||
tp::List<Instruction> mInstructions;
|
||||
|
||||
FunctionDefinition(tp::String function_id, tp::Buffer<tp::String> args, FunctionDefinition* prnt);
|
||||
FunctionDefinition() {}
|
||||
|
||||
void generateByteCode(ByteCode& out);
|
||||
|
||||
tp::List<Instruction>::Node* inst(Instruction inst);
|
||||
|
||||
void EvalExpr(Expression* expr);
|
||||
void EvalStatement(Statement* expr);
|
||||
|
||||
ConstObject* defineLocal(tp::String id);
|
||||
};
|
||||
|
||||
void init();
|
||||
void deinit();
|
||||
void Genereate(ByteCode& out, StatementScope* body);
|
||||
bool Compile(MethodObject* obj);
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue