First pass at functions + tests
This commit is contained in:
1 parent
dd0d340eba
commit
c128c2029e
15 files changed
+461
-89
No files matched your search
+11
-2
@@ -19,6 +19,12 @@ struct symbol_table {
|
||||
int ncfunctions;
|
||||
};
|
||||
|
||||
// The bytecode format matters in:
|
||||
// execute.c - interpreter
|
||||
// compile.c - compiler
|
||||
// bytecode.c - disassembler
|
||||
|
||||
#define ARG_NEWCLOSURE 0x1000
|
||||
|
||||
struct bytecode {
|
||||
uint16_t* code;
|
||||
@@ -30,11 +36,14 @@ struct bytecode {
|
||||
json_t* constants;
|
||||
struct symbol_table* globals;
|
||||
|
||||
struct bytecode* subfunctions;
|
||||
struct bytecode** subfunctions;
|
||||
int nsubfunctions;
|
||||
|
||||
struct bytecode* parent;
|
||||
};
|
||||
|
||||
void dump_disassembly(struct bytecode* code);
|
||||
void dump_disassembly(int, struct bytecode* code);
|
||||
void dump_code(int, struct bytecode* code);
|
||||
void dump_operation(struct bytecode* bc, uint16_t* op);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user