diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-01-30 08:54:18 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-01-30 08:54:18 +0330 |
commit | 9f2b1bdcfbbc084876c3ab7cc2cb8c15ffb88184 (patch) | |
tree | cf46656b50fa3d868a7bed4821667f6a31ea922c /src/compiler/ast-tree.h | |
parent | d32d148cee5b3aec5e8943738aa30139d442478c (diff) |
added assign operator
Diffstat (limited to 'src/compiler/ast-tree.h')
-rw-r--r-- | src/compiler/ast-tree.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/compiler/ast-tree.h b/src/compiler/ast-tree.h index 90133a5..2e43973 100644 --- a/src/compiler/ast-tree.h +++ b/src/compiler/ast-tree.h @@ -19,15 +19,21 @@ typedef enum AstTreeToken { AST_TREE_TOKEN_VARIABLE_DEFINE, AST_TREE_TOKEN_VALUE_U64, + AST_TREE_TOKEN_OPERATOR_ASSIGN, + AST_TREE_TOKEN_NONE, } AstTreeToken; +extern const char *AST_TREE_TOKEN_STRINGS[]; + typedef struct AstTree { AstTreeToken token; - void *metadata; bool typeChecked; + void *metadata; } AstTree; +extern const AstTree AST_TREE_U64_TYPE; + typedef struct AstTreeVariable { char *name_begin; char *name_end; @@ -73,7 +79,12 @@ typedef uint64_t AstTreeU64; typedef AstTree AstTreeSingleChild; -extern const char *AST_TREE_TOKEN_STRINGS[]; +typedef struct AstTreeInfix { + AstTree left; + AstTree right; + AstTree leftType; + AstTree rightType; +} AstTreeInfix; void astTreePrint(const AstTree *tree, int indent); void astTreeRootPrint(const AstTreeRoot *root); @@ -117,6 +128,10 @@ AstTree *astTreeParsePrintU64(ParserNode *parserNode, AstTreeVariables **variables, size_t variables_size); +AstTree *astTreeParseAssign(ParserNode *parserNode, + AstTreeVariables **variables, + size_t variables_size); + bool astTreeParseConstant(ParserNode *parserNode, AstTreeVariables **variables, size_t variables_size); @@ -137,7 +152,10 @@ bool setTypesPrintU64(AstTree *tree); bool setTypesTypeFunction(AstTree *tree); bool setTypesFunctionCall(AstTree *tree); bool setTypesVariable(AstTree *tree); +bool setTypesOperatorAssign(AstTree *tree); + bool setTypesAstVariable(AstTreeVariable *variable); +bool setTypesAstInfix(AstTreeInfix *infix); bool astTreeCleanRoot(AstTreeRoot *root); bool astTreeClean(AstTree *tree); |