49 lines
822 B
C
49 lines
822 B
C
#ifndef RUNTIME_H
|
|
#define RUNTIME_H
|
|
|
|
#include "lexer.h"
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct Alloc {
|
|
void* (*alloc)(struct Alloc* alloc, size_t size);
|
|
} Alloc;
|
|
|
|
typedef enum {
|
|
ValueTypeSymbol,
|
|
ValueTypeInt,
|
|
ValueTypeChar,
|
|
ValueTypeBool,
|
|
ValueTypeList,
|
|
} ValueType;
|
|
|
|
typedef struct Value Value;
|
|
|
|
typedef struct {
|
|
Alloc* alloc;
|
|
Value* data;
|
|
size_t length;
|
|
size_t capacity;
|
|
} ValueVec;
|
|
|
|
void value_vec_construct(ValueVec* vec, Alloc* alloc);
|
|
void value_vec_destroy(ValueVec* vec);
|
|
|
|
struct Value {
|
|
ValueType type;
|
|
union {
|
|
int64_t int_value;
|
|
char char_value;
|
|
bool bool_value;
|
|
String string_value;
|
|
};
|
|
};
|
|
|
|
typedef struct {
|
|
} Runtime;
|
|
|
|
void runtime_construct(Runtime* runtime);
|
|
void runtime_destroy(Runtime* runtime);
|
|
|
|
#endif
|