Files
clox/include/vm.h
Daniel Henry 495545ef22 Finish Chapter 16
Implement basic parsing / scanner

Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
2025-08-22 03:43:08 -05:00

29 lines
423 B
C

#ifndef clox_vm_h
#define clox_vm_h
#include "chunk.h"
#define STACK_MAX 256
typedef struct {
Chunk *chunk;
uint8_t *ip;
Value stack[STACK_MAX];
Value *stackTop;
} VM;
typedef enum {
INTERPRET_OK,
INTERPRET_COMPILE_ERROR,
INTERPRET_RUNTIME_ERROR
} InterpretResult;
void initVM();
void freeVM();
InterpretResult interpret(const char *source);
void push(Value value);
Value pop();
#endif /* clox_vm_h */