My implementation of Clox, the programming language constructed in the book 'Crafting Interpreters' http://www.craftinginterpreters.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
clox/vm.h

28 lines
425 B

#ifndef _VM_H
#define _VM_H
#include "chunk.h"
#define MAX_STACK 256
typedef struct {
Chunk* chunk;
uint8_t* ip;
Value stack[MAX_STACK];
Value* sp;
} VM;
typedef enum {
INTERPRET_OK,
INTERPRET_COMPILE_ERROR,
INTERPRET_RUNTIME_ERROR
} InterpretResult;
void initVM( VM* vm );
void freeVM( VM* vm );
InterpretResult interpret( VM* vm, const char* src );
void push( VM* vm, Value val );
Value pop( VM* vm );
#endif