Refactor AST and Parser into modular subdirectories
- Split ast.h into granular headers in v0/ast/ - Split parser.c into modular implementation files in v0/parser/ - Move and rename parser tests to v0/parser/test_*.c - Update build system (include.mk) with modular sub-makefiles - Maintain v0/ast.h and v0/parser.h as umbrella headers
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#ifndef AST_DECLARATION_H
|
||||
#define AST_DECLARATION_H
|
||||
|
||||
#include "expression.h"
|
||||
#include "../bool.h"
|
||||
|
||||
typedef struct {
|
||||
/** @brief The name of the module being imported. */
|
||||
char* module_name;
|
||||
|
||||
/** @brief Whether the import is public or not. */
|
||||
bool is_public;
|
||||
} ImportDeclaration;
|
||||
|
||||
/**
|
||||
* A declaration that aliases one type to another.
|
||||
*/
|
||||
typedef struct {
|
||||
/** @brief The name of the alias. */
|
||||
const char* name;
|
||||
|
||||
/** @brief The value of the alias. */
|
||||
TypeExpression value;
|
||||
} 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 The optional initializer expression. */
|
||||
Expression* initializer;
|
||||
|
||||
/** @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;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user