feat: 新增 i32 / u64 / char 类型 + 字符字面量 "'a'"

This commit is contained in:
2026-06-05 20:47:44 +08:00
parent 6fc599e6c2
commit 18172ca724
12 changed files with 146 additions and 16 deletions
+7
View File
@@ -137,6 +137,13 @@ AstNode* ast_make_literal_bool(void* alloc, bool val, SourceLoc loc) {
return n;
}
AstNode* ast_make_literal_char(void* alloc, int val, SourceLoc loc) {
NEW(alloc, AST_LITERAL_EXPR);
n->as.literal.lit_type = TYPE_CHAR; n->as.literal.i64_val = val;
n->type.kind = TYPE_CHAR;
return n;
}
AstNode* ast_make_literal_str(void* alloc, const char* val, SourceLoc loc) {
NEW(alloc, AST_LITERAL_EXPR);
n->as.literal.lit_type = TYPE_STR; n->as.literal.str_val = val;