34 lines
919 B
C
34 lines
919 B
C
#ifndef FLUP_INTERPRETER_H
|
|
#define FLUP_INTERPRETER_H
|
|
|
|
#include "../submodules/utilitiec/src/dynamicarray/dynamicarray.h"
|
|
#include "../submodules/utilitiec/src/Scratchpad/Scratchpad.h"
|
|
|
|
#include "tokenizer.h"
|
|
#include "callframe.h"
|
|
#include "value.h"
|
|
#include <stdint.h>
|
|
|
|
typedef struct Interpreter_s Interpreter;
|
|
|
|
typedef int (*BuiltinFunction)(CallFrame *, Interpreter* interpreter);
|
|
|
|
struct Interpreter_s {
|
|
const char** builtin_names;
|
|
const BuiltinFunction* builtin_functions;
|
|
|
|
DynamicArray* tokens;
|
|
DynamicArray call_frames; // stores CallFrame
|
|
|
|
// global stuff
|
|
ObjectType* implicit_char_type;
|
|
ObjectType* implicit_base_type;
|
|
};
|
|
|
|
int Interpreter_Create(Interpreter* self, DynamicArray* tokens);
|
|
int Interpreter_Interpret(Interpreter* self);
|
|
void Interpreter_Destroy(Interpreter* self);
|
|
|
|
Token* Interpreter_ExpectToken(Interpreter* self, CallFrame* top_frame, size_t stop_index);
|
|
|
|
#endif //FLUP_INTERPRETER_H
|