#ifndef AST_EXPRESSION_H #define AST_EXPRESSION_H #include "../bool.h" typedef enum { EXPRESSION_TREE_INTEGER, EXPRESSION_TREE_STRING, EXPRESSION_TREE_BOOLEAN } ExpressionTreeTag; typedef struct { ExpressionTreeTag tag; union { int integer; const char* string; bool boolean; }; } ExpressionTree; typedef enum { TYPE_TREE_BUILTIN, TYPE_TREE_ARRAY } TypeTreeTag; /** * An expression that evaluates to a type. */ typedef struct TypeTree TypeTree; struct TypeTree { /** @brief defines which entry in the union is valid */ 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. */ TypeTree* array; } array; /** @brief Evaluates to a builtin integer type.*/ struct { /** * @brief The number of bits in the integer. * Typical values are 8, 16, 32, and 64. */ int bitSize; /** @brief `true` if the type is signed, `false` if it's unsigned. */ bool isSigned; } builtin; }; }; #endif