compiler now compiles some things

This commit is contained in:
Lobo 2026-01-19 12:50:54 -03:00
parent 9616fb616e
commit ce345f2440
13 changed files with 425 additions and 74 deletions

View file

@ -1,11 +1,14 @@
#ifndef CHUNK_H
#define CHUNK_H
#define CHUNK_DEBUG 0
#include "common.h"
#include "object.h"
/** Bytecode chunk */
typedef struct Bc {
I ref;
U8 *items;
Z count, capacity;
struct {
@ -14,9 +17,12 @@ typedef struct Bc {
} constants;
} Bc;
Bc *chunk_new(V);
V chunk_acquire(Bc *);
V chunk_release(Bc *);
V chunk_emit_byte(Bc *, U8);
V chunk_emit_sleb128(Bc *, I);
I chunk_add_constant(Bc *, O);
V chunk_free(Bc *);
#endif