mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-17 15:54:07 +10:00
Wrote the interpreter
This commit is contained in:
20
source/interpreter.h
Normal file
20
source/interpreter.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "opcodes.h"
|
||||
|
||||
#include "literal_array.h"
|
||||
|
||||
//the interpreter acts depending on the bytecode instructions
|
||||
typedef struct Interpreter {
|
||||
LiteralArray literalCache; //generally doesn't change after initialization
|
||||
unsigned char* bytecode;
|
||||
int length;
|
||||
int count;
|
||||
|
||||
LiteralArray stack;
|
||||
} Interpreter;
|
||||
|
||||
void initInterpreter(Interpreter* interpreter, unsigned char* bytecode, int length);
|
||||
void freeInterpreter(Interpreter* interpreter);
|
||||
|
||||
void runInterpreter(Interpreter* interpreter);
|
||||
Reference in New Issue
Block a user