chunk.c
Structures and enums for bytecode chunks.
Functions for dealing with garbage collection and memory allocation.
void krk_freeChunk(KrkChunk *chunk)
Release the resources allocated to an opcode chunk.
Definition: chunk.c:42
void krk_emitConstant(KrkChunk *chunk, size_t ind, size_t line)
Write an OP_CONSTANT(_LONG) instruction.
Definition: chunk.c:56
size_t krk_writeConstant(KrkChunk *chunk, KrkValue value, size_t line)
Add a new constant and write an instruction for it.
Definition: chunk.c:68
size_t krk_lineNumber(KrkChunk *chunk, size_t offset)
Obtain the line number for a byte offset into a bytecode chunk.
Definition: chunk.c:74
size_t krk_addConstant(KrkChunk *chunk, KrkValue value)
Add a new constant value to an opcode chunk.
Definition: chunk.c:49
void krk_writeChunk(KrkChunk *chunk, uint8_t byte, size_t line)
Append a byte to an opcode chunk.
Definition: chunk.c:30
void krk_freeValueArray(KrkValueArray *array)
Release relesources used by a value array.
Definition: value.c:28
void krk_writeValueArray(KrkValueArray *array, KrkValue value)
Add a value to a value array.
Definition: value.c:17
Stack reference or primative value.
Core API for the bytecode virtual machine.