Rename AST structures to Tree and relocate freeing logic

This commit is contained in:
2026-04-30 21:46:15 +02:00
parent ea55dedd07
commit 177fb971e4
17 changed files with 162 additions and 153 deletions
+13 -13
View File
@@ -4,37 +4,37 @@
#include "../bool.h"
typedef enum {
EXPRESSION_INTEGER,
EXPRESSION_STRING,
EXPRESSION_BOOLEAN
} ExpressionTag;
EXPRESSION_TREE_INTEGER,
EXPRESSION_TREE_STRING,
EXPRESSION_TREE_BOOLEAN
} ExpressionTreeTag;
typedef struct {
ExpressionTag tag;
ExpressionTreeTag tag;
union {
int integer;
const char* string;
bool boolean;
};
} Expression;
} ExpressionTree;
typedef enum {
TYPE_EXPRESSION_BUILTIN,
TYPE_EXPRESSION_ARRAY
} TypeExpressionTag;
TYPE_TREE_BUILTIN,
TYPE_TREE_ARRAY
} TypeTreeTag;
/**
* An expression that evaluates to a type.
*/
typedef struct TypeExpression TypeExpression;
struct TypeExpression {
typedef struct TypeTree TypeTree;
struct TypeTree {
/** @brief defines which entry in the union is valid */
TypeExpressionTag tag;
TypeTreeTag tag;
union {
/** @brief Evaluates to an array of the given type. */
struct {
/** @brief A pointer to the type of the elements stored in the array. */
TypeExpression* array;
TypeTree* array;
} array;
/** @brief Evaluates to a builtin integer type.*/
struct {