diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-01-29 06:26:49 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-01-29 06:26:49 +0330 |
commit | 258ad19e6e03e1f1a93e16972cac1096a2d93e04 (patch) | |
tree | 4294fe5a39f4d148a0a616884036284de6dbc590 /src/compiler/ast-tree.h | |
parent | f8019d33f61807de5369d78de6216427c56500dd (diff) |
add global variables
fix shadowing in different levels
better type checking
Diffstat (limited to 'src/compiler/ast-tree.h')
-rw-r--r-- | src/compiler/ast-tree.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/compiler/ast-tree.h b/src/compiler/ast-tree.h index 7590003..852441c 100644 --- a/src/compiler/ast-tree.h +++ b/src/compiler/ast-tree.h @@ -15,7 +15,7 @@ typedef enum AstTreeToken { AST_TREE_TOKEN_TYPE_U64, AST_TREE_TOKEN_FUNCTION_CALL, - AST_TREE_TOKEN_CONSTANT, + AST_TREE_TOKEN_VARIABLE, AST_TREE_TOKEN_VALUE_U64, AST_TREE_TOKEN_NONE, @@ -24,6 +24,7 @@ typedef enum AstTreeToken { typedef struct AstTree { AstTreeToken token; void *metadata; + bool typeChecked; } AstTree; typedef struct AstTreeVariable { @@ -114,10 +115,19 @@ AstTree *astTreeParsePrintU64(ParserNode *parserNode, AstTreeVariables **variables, size_t variables_size); -bool astTreeParseConstant(ParserNode *parserNode, - AstTreeVariables **variables, - size_t variables_size); +bool astTreeParseConstant(ParserNode *parserNode, AstTreeVariables **variables, + size_t variables_size); -bool hasTypeOf(AstTree *value,const AstTree *type); +bool hasTypeOf(AstTree *value, const AstTree *type); +bool isFunction(AstTree *value); AstTree *makeTypeOf(AstTree *value); bool typeIsEqual(const AstTree *type0, const AstTree *type1); + +bool setAllTypesRoot(AstTreeRoot *root); +bool setAllTypes(AstTree *tree); +bool setTypesFunction(AstTree *tree); +bool setTypesPrintU64(AstTree *tree); +bool setTypesTypeFunction(AstTree *tree); +bool setTypesFunctionCall(AstTree *tree); +bool setTypesVariable(AstTree *tree); +bool setTypesAstVariable(AstTreeVariable *variable); |