clox/include/vm.h
2024-09-08 15:57:08 -05:00

33 lines
482 B
C

#ifndef VM_H
#define VM_H
#include "chunk.h"
#include "value.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,
INTERPRET_RESULT_COUNT,
} InterpretResult;
extern VM vm;
void initVM(void);
void freeVM(void);
InterpretResult interpret(const char *source);
void push(Value value);
Value pop();
#endif