source tracking and composite primitives

This commit is contained in:
Lobo 2026-01-21 10:48:06 -03:00
parent b9a5bc5e63
commit aebe586a05
9 changed files with 237 additions and 220 deletions

View file

@ -6,7 +6,12 @@
#include "common.h"
#include "object.h"
/** Bytecode chunk */
typedef struct Bl {
Z offset;
I row;
I col;
} Bl;
typedef struct Bc {
I ref;
const char *name;
@ -16,6 +21,10 @@ typedef struct Bc {
O *items;
Z count, capacity;
} constants;
struct {
Bl *items;
Z count, capacity;
} lines;
} Bc;
Bc *chunk_new(const char *);
@ -26,4 +35,7 @@ V chunk_emit_byte(Bc *, U8);
V chunk_emit_sleb128(Bc *, I);
I chunk_add_constant(Bc *, O);
V chunk_emit_byte_with_line(Bc *, U8, I, I);
I chunk_get_line(Bc *, Z, I*);
#endif