#ifndef RUNTIME_H #define RUNTIME_H #include "allocator.h" #include "lexer.h" #include #include typedef enum { ValueTypeSymbol, ValueTypeInt, ValueTypeChar, ValueTypeBool, ValueTypeList, } ValueType; typedef struct Value Value; typedef struct { Allocator* allocator; Value* data; size_t length; size_t capacity; } ValueVec; void value_vec_construct(ValueVec* vec, Allocator* allocator); void value_vec_destroy(ValueVec* vec); Value* value_vec_at(const ValueVec* vec, int64_t index); void value_vec_reserve(ValueVec* vec, size_t min_capacity); void value_vec_push(ValueVec* vec, Value value); Value value_vec_pop(ValueVec* vec); ValueVec value_vec_clone(ValueVec* vec); ValueVec value_vec_tail(ValueVec* vec); void value_vec_stringify(const ValueVec* vec, String* acc); struct Value { ValueType type; union { String symbol; int64_t int_value; char char_value; bool bool_value; ValueVec list; }; }; void value_destroy(Value* value); void value_stringify(const Value* value, String* acc); typedef struct { Allocator* allocator; ValueVec stack; } Runtime; void runtime_construct(Runtime* runtime, Allocator* allocator); void runtime_destroy(Runtime* runtime); #endif