diff options
author | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2025-05-20 14:18:30 +0200 |
---|---|---|
committer | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2025-05-20 14:18:30 +0200 |
commit | fbbe2f207a26b410d485c9dea07a22256a02d50b (patch) | |
tree | 164e2d30f43bd25ecc7c3f6ca4d49d1c30f4f1a7 /include | |
parent | 9cf524df8c94920d7c7058692f2f83a95a4006e0 (diff) | |
download | imp-fbbe2f207a26b410d485c9dea07a22256a02d50b.tar.gz imp-fbbe2f207a26b410d485c9dea07a22256a02d50b.zip |
local variables
Diffstat (limited to 'include')
-rw-r--r-- | include/ast.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/ast.h b/include/ast.h index c619c72..8482aab 100644 --- a/include/ast.h +++ b/include/ast.h @@ -4,7 +4,7 @@ typedef enum { NT_SKIP, NT_ASSIGN, NT_SEQ, NT_IF, NT_WHILE, - NT_INT, NT_VAR, NT_AOP, NT_BOP, NT_NOT, NT_ROP + NT_INT, NT_VAR, NT_AOP, NT_BOP, NT_NOT, NT_ROP, NT_LET } NodeType; typedef enum { AOP_ADD, AOP_SUB, AOP_MUL } AOp; @@ -24,6 +24,7 @@ typedef struct ASTNode { struct { BOp bop; struct ASTNode *bexp1, *bexp2; } d_bop; struct { struct ASTNode *bexp; } d_not; struct { ROp rop; struct ASTNode *aexp1, *aexp2; } d_rop; + struct { struct ASTNode *var, *aexp, *stm; } d_let; } u; } ASTNode; @@ -39,6 +40,7 @@ ASTNode *ast_aop(AOp aop, ASTNode *aexp1, ASTNode *aexp2); ASTNode *ast_bop(BOp bop, ASTNode *bexp1, ASTNode *bexp2); ASTNode *ast_not(ASTNode *bexp); ASTNode *ast_rop(ROp rop, ASTNode *aexp1, ASTNode *aexp2); +ASTNode *ast_let(ASTNode *var, ASTNode *aexp, ASTNode *stm); void ast_free(ASTNode *node); |