27 lines
426 B
C
27 lines
426 B
C
#ifndef ztl_chunk_h
|
|
#define ztl_chunk_h
|
|
|
|
#include "common.h"
|
|
#include "memory.h"
|
|
#include "value.h"
|
|
|
|
typedef enum {
|
|
OP_NOOP,
|
|
OP_CONSTANT,
|
|
OP_RETURN,
|
|
} OpCode;
|
|
|
|
typedef struct Chunk {
|
|
int count;
|
|
int capacity;
|
|
uint8_t *code;
|
|
ValueArray constants;
|
|
} Chunk;
|
|
|
|
void newChunk(Chunk *chunk);
|
|
void freeChunk(Chunk *chunk);
|
|
void writeChunk(Chunk *chunk, uint8_t byte);
|
|
int addConstant(Chunk *chunk, Value value);
|
|
|
|
#endif
|