diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 99b839e..5cdc6fe 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -26,9 +26,8 @@ There will be no `test_buffer.h`. Instead, `test.c` will directly Every syntax error path identified in the parser MUST have a corresponding test. ## Language Syntax -Since this is a compiler for a new language, do not assume anything -of its syntax. -Always check the `specs` directory. +Since this is a compiler for a new language, do not assume anything of its syntax. +Always check the `specs` directory to see examples and documentation about the language. If there is anything unclear, ask the user for clarification. It is certainly possible that there are contradictions in the diff --git a/v0/ast.h b/v0/ast.h index 69e01f5..2e520b1 100644 --- a/v0/ast.h +++ b/v0/ast.h @@ -62,6 +62,26 @@ typedef struct { bool is_public; } AliasDeclaration; +/** + * A declaration of a variable, which may be a constant or not, and may be static or not. + */ +typedef struct { + /** @brief The name of the variable. */ + char* name; + + /** @brief The type of the variable. */ + TypeExpression type; + + /** @brief Whether the variable is public or not. */ + bool is_public; + + /** @brief Whether the variable is static or not. */ + bool is_static; + + /** @brief Whether the variable is a constant or not. */ + bool is_const; +} VariableDeclaration; + /** * The top-level model. * Every file matches an entire Module. @@ -81,6 +101,12 @@ typedef struct { /** @brief The number of aliases in the module. */ size_t alias_count; + + /** @brief The list of variables in the module. */ + VariableDeclaration* variables; + + /** @brief The number of variables in the module. */ + size_t variable_count; } Module; #endif