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"
|
2024-10-01 21:37:26 +02:00
|
|
|
#include "../submodules/utilitiec/src/Scratchpad/Scratchpad.h"
|
2024-10-01 10:53:26 +02:00
|
|
|
|
|
|
|
#include "tokenizer.h"
|
2024-10-08 17:17:10 +02:00
|
|
|
#include "callframe.h"
|
|
|
|
#include "value.h"
|
2024-10-01 10:53:26 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-10-08 17:17:10 +02:00
|
|
|
typedef struct Interpreter_s Interpreter;
|
2024-10-01 10:53:26 +02:00
|
|
|
|
2024-10-08 17:17:10 +02:00
|
|
|
typedef int (*BuiltinFunction)(CallFrame *);
|
2024-10-01 10:53:26 +02:00
|
|
|
|
2024-10-08 17:17:10 +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
|
2024-10-08 17:17:10 +02:00
|
|
|
};
|
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);
|
|
|
|
|
2024-10-08 17:17:10 +02:00
|
|
|
#endif //FLUP_INTERPRETER_H
|