aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/chunk.h
blob: 3e1c00570cc429c2ee0372e688f281a9225d972f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef BDL_CHUNK_H
#define BDL_CHUNK_H

#include "darray.h"

typedef struct Object Object;

typedef struct LineInfo {
    size_t line;
    size_t col;
} LineInfo;

typedef struct Chunk {
    u8 *code;
    Object *constants;
    LineInfo *lines;
} Chunk;

Chunk * chunk_init(void);
void add_code(Chunk *chunk, u8 byte, size_t line, size_t col);
size_t add_constant(Chunk *chunk, Object obj);
void chunk_free(Chunk *chunk);

#endif // BDL_CHUNK_H