Wrote the interpreter

This commit is contained in:
2022-08-06 07:58:32 +01:00
parent 0048c92cf5
commit 7a3986af33
10 changed files with 292 additions and 27 deletions

20
source/interpreter.h Normal file
View 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);