flup/src/interpreter.h

33 lines
800 B
C
Raw Normal View History

2024-10-01 10:53:26 +02:00
#ifndef FLUP_INTERPRETER_H
#define FLUP_INTERPRETER_H
2024-10-01 11:07:46 +02:00
#include "../submodules/utilitiec/src/dynamicarray/dynamicarray.h"
#include "../submodules/utilitiec/src/Scratchpad/Scratchpad.h"
2024-10-01 10:53:26 +02:00
#include "tokenizer.h"
#include "callframe.h"
#include "value.h"
2024-10-01 10:53:26 +02:00
#include <stdint.h>
typedef struct Interpreter_s Interpreter;
2024-10-01 10:53:26 +02:00
typedef int (*BuiltinFunction)(CallFrame *);
2024-10-01 10:53:26 +02:00
struct Interpreter_s {
const char** builtin_names;
const BuiltinFunction* builtin_functions;
2024-10-01 10:53:26 +02:00
DynamicArray* tokens;
DynamicArray call_frames; // stores CallFrame
// global stuff
ObjectType* implicit_char_type;
ObjectType* implicit_base_type;
};
2024-10-01 10:53:26 +02:00
int Interpreter_Create(Interpreter* self, DynamicArray* tokens);
int Interpreter_Interpret(Interpreter* self);
void Interpreter_Destroy(Interpreter* self);
#endif //FLUP_INTERPRETER_H