diff options
author | Bad Diode <bd@badd10de.dev> | 2022-02-01 18:36:52 +0100 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2022-02-01 18:36:52 +0100 |
commit | ee1a5de91c875fb66724dc21c02333bfebe2a812 (patch) | |
tree | d3eaa226816d295bb9dc48a2aed27044832ec413 /src/bytecode/chunk.h | |
parent | 3156265c7b2da8cc43fee996c0518ea274d39c8a (diff) | |
download | bdl-ee1a5de91c875fb66724dc21c02333bfebe2a812.tar.gz bdl-ee1a5de91c875fb66724dc21c02333bfebe2a812.zip |
Add new syntax to lexer and prepare refactor
Diffstat (limited to 'src/bytecode/chunk.h')
-rwxr-xr-x | src/bytecode/chunk.h | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/bytecode/chunk.h b/src/bytecode/chunk.h deleted file mode 100755 index 9457fa9..0000000 --- a/src/bytecode/chunk.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #ifndef BDL_CHUNK_H | ||
2 | #define BDL_CHUNK_H | ||
3 | |||
4 | #include "darray.h" | ||
5 | #include "string_view.h" | ||
6 | |||
7 | typedef struct Object Object; | ||
8 | |||
9 | typedef struct LineInfo { | ||
10 | size_t line; | ||
11 | size_t col; | ||
12 | } LineInfo; | ||
13 | |||
14 | typedef struct Chunk { | ||
15 | // Program code. | ||
16 | u8 *code; | ||
17 | // Compile time constants. | ||
18 | Object *constants; | ||
19 | // Contains debugging information for every code operation. | ||
20 | LineInfo *lines; | ||
21 | // Chunk name. | ||
22 | char *name; | ||
23 | |||
24 | // Number of locals and parameters. | ||
25 | size_t n_params; | ||
26 | size_t n_locals; | ||
27 | } Chunk; | ||
28 | |||
29 | #define NEW_CHUNK(NAME) chunk_init((StringView){(NAME), sizeof(NAME) - 1}) | ||
30 | |||
31 | Chunk * chunk_init(StringView name); | ||
32 | void add_code(Chunk *chunk, u8 byte, size_t line, size_t col); | ||
33 | size_t add_constant(Chunk *chunk, Object obj); | ||
34 | void chunk_free(Chunk *chunk); | ||
35 | |||
36 | #endif // BDL_CHUNK_H | ||