#ifndef FLUP_INTERPRETER_H #define FLUP_INTERPRETER_H #include "../submodules/utilitiec/src/dynamicarray/dynamicarray.h" #include "tokenizer.h" #include typedef struct FlupFunctionAlternative_s { size_t condition_token_start; size_t condition_token_end; size_t body_token_start; size_t body_token_end; struct FlupFunctionAlternative_s* next; } FlupFunctionAlternative; typedef struct ParameterDefinition_s { StringView name; StringView type; } ParameterDefinition; typedef struct FlupFunction_s { StringView name; DynamicArray argument_defs; // ParameterDefinition StringView return_type; FlupFunctionAlternative* alternative; } FlupFunction; enum ValueType { VALUETYPE_INT64, VALUETYPE_DOUBLE }; union ValueContent { int64_t i64; double f64; }; typedef struct Value_s { enum ValueType type; union ValueContent get; } Value; typedef struct CallFrame_s { size_t instruction_pointer; FlupFunctionAlternative* function; DynamicArray stack; // Value } CallFrame; typedef struct Interpreter_s { DynamicArray* tokens; DynamicArray call_frames; // stores CallFrame } Interpreter; int Interpreter_Create(Interpreter* self, DynamicArray* tokens); int Interpreter_Interpret(Interpreter* self); void Interpreter_Destroy(Interpreter* self); #endif //header guard