diff options
Diffstat (limited to 'clox/src/chunk.h')
-rw-r--r-- | clox/src/chunk.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clox/src/chunk.h b/clox/src/chunk.h new file mode 100644 index 0000000..466898b --- /dev/null +++ b/clox/src/chunk.h @@ -0,0 +1,25 @@ +#ifndef clox_chunk_h +#define clox_chunk_h + +#include "common.h" +#include "value.h" + +typedef enum { + OP_CONSTANT, + OP_RETURN, +} OpCode; + +typedef struct { + int count; + int capacity; + uint8_t* code; + int* lines; + ValueArray constants; +} Chunk; + +void initChunk(Chunk* chunk); +void freeChunk(Chunk* chunk); +void writeChunk(Chunk* chunk, uint8_t byte, int line); +int addConstant(Chunk* chunk, Value value); + +#endif |