aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.h')
-rw-r--r--src/ast.h7
1 files changed, 7 insertions, 0 deletions
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,
@@ -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);