diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-07 19:06:29 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-07 19:06:38 +0900 |
| commit | 0ae64ed2c00f66c7f3ddec8689169bacafff87ea (patch) | |
| tree | c72db385bca5de58910f2769168a7b0918309c21 /src/ast.h | |
| parent | 7ba8a506a215846d14d71487807f5e525e9e5c16 (diff) | |
| download | ducc-0ae64ed2c00f66c7f3ddec8689169bacafff87ea.tar.gz ducc-0ae64ed2c00f66c7f3ddec8689169bacafff87ea.tar.zst ducc-0ae64ed2c00f66c7f3ddec8689169bacafff87ea.zip | |
feat: partially support float/double
Diffstat (limited to 'src/ast.h')
| -rw-r--r-- | src/ast.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -112,6 +112,7 @@ typedef enum { AstNodeKind_gvar_decl, AstNodeKind_if_stmt, AstNodeKind_int_expr, + AstNodeKind_double_expr, AstNodeKind_label_stmt, AstNodeKind_list, AstNodeKind_logical_expr, @@ -143,6 +144,10 @@ typedef struct { } IntExprNode; typedef struct { + double value; +} DoubleExprNode; + +typedef struct { int idx; } StrExprNode; @@ -325,6 +330,7 @@ struct AstNode { Type* ty; union { IntExprNode* int_expr; + DoubleExprNode* double_expr; StrExprNode* str_expr; UnaryExprNode* unary_expr; BinaryExprNode* binary_expr; @@ -374,6 +380,7 @@ AstNode* ast_new(AstNodeKind kind); AstNode* ast_new_list(int capacity); void ast_append(AstNode* list, AstNode* item); AstNode* ast_new_int(int v); +AstNode* ast_new_double(double v); AstNode* ast_new_unary_expr(int op, AstNode* operand); AstNode* ast_new_binary_expr(int op, AstNode* lhs, AstNode* rhs); |
