mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
The tests are failing in a strange way, with the error message 'corrupted top size'. I don't know what it means, and it seems to be caused by a call to printf() within 'test_bytecode.c'. I need a break, as this is making me dizzy.
29 lines
696 B
C
29 lines
696 B
C
#pragma once
|
|
|
|
#include "toy_common.h"
|
|
#include "toy_ast.h"
|
|
|
|
//routine - holds the individual parts of a compiled routine
|
|
typedef struct Toy_Routine {
|
|
unsigned char* param; //c-string params in sequence
|
|
int paramCapacity;
|
|
int paramCount;
|
|
|
|
unsigned char* code; //the instruction set
|
|
int codeCapacity;
|
|
int codeCount;
|
|
|
|
unsigned char* data; //{type,val} tuples of data
|
|
int dataCapacity;
|
|
int dataCount;
|
|
|
|
int* jump; //each 'jump' is the starting address of an element within 'data'
|
|
int jumpCapacity;
|
|
int jumpCount;
|
|
|
|
//TODO: duplicate the data and jumps for subroutines
|
|
} Toy_Routine;
|
|
|
|
TOY_API Toy_Routine Toy_compileRoutine(Toy_Ast* ast);
|
|
TOY_API void Toy_freeRoutine(Toy_Routine routine);
|