zongors-universe-machine/src/vm.h

30 lines
423 B
C

#ifndef ztl_vm_h
#define ztl_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
} InterpretResult;
void newVM();
void freeVM();
InterpretResult interpret(const char* source);
void push(Value value);
Value pop();
#endif