From 0ae64ed2c00f66c7f3ddec8689169bacafff87ea Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 7 Feb 2026 19:06:29 +0900 Subject: feat: partially support float/double --- src/ast.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index fe2f720..79d58d0 100644 --- a/src/ast.h +++ b/src/ast.h @@ -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, @@ -142,6 +143,10 @@ typedef struct { int value; } 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); -- cgit v1.3-1-g0d28