Rename AST structures to Tree and relocate freeing logic
This commit is contained in:
+13
-13
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user