More variable stuff

This commit is contained in:
2026-04-30 20:25:53 +02:00
parent 0704284726
commit 4bd66ea216
10 changed files with 144 additions and 14 deletions
+20 -5
View File
@@ -17,6 +17,21 @@ typedef struct {
bool is_public;
} ImportDeclaration;
typedef enum {
EXPRESSION_INTEGER,
EXPRESSION_STRING,
EXPRESSION_BOOLEAN
} ExpressionTag;
typedef struct {
ExpressionTag tag;
union {
int integer;
const char* string;
bool boolean;
};
} Expression;
typedef enum {
TYPE_EXPRESSION_BUILTIN,
TYPE_EXPRESSION_ARRAY
@@ -26,7 +41,7 @@ typedef enum {
* An expression that evaluates to a type.
*/
typedef struct TypeExpression TypeExpression;
struct TypeExpression{
struct TypeExpression {
/** @brief defines which entry in the union is valid */
TypeExpressionTag tag;
union {
@@ -53,13 +68,10 @@ struct TypeExpression{
*/
typedef struct {
/** @brief The name of the alias. */
char* name;
const char* name;
/** @brief The value of the alias. */
TypeExpression value;
/** @brief Whether the import is public or not. */
bool is_public;
} AliasDeclaration;
/**
@@ -72,6 +84,9 @@ typedef struct {
/** @brief The type of the variable. */
TypeExpression type;
/** @brief The optional initializer expression. */
Expression* initializer;
/** @brief Whether the variable is public or not. */
bool is_public;