source tracking and composite primitives
This commit is contained in:
parent
b9a5bc5e63
commit
aebe586a05
9 changed files with 237 additions and 220 deletions
14
src/chunk.h
14
src/chunk.h
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue