switch cast expressions from being formally represented in the expression tree - instead use cast-like tree shapes to perform casts in the ir/typechecking phase. this is odd, given C's casting syntax, but it is much more natural given that the parser is not any longer doing identifier resolution, and as such it fixes a bunch of nasty edge cases.

This commit is contained in:
Ryan Fleury
2025-04-28 11:50:23 -07:00
parent 81425e8b90
commit c62ad20a9a
13 changed files with 325 additions and 130 deletions
+4 -2
View File
@@ -144,7 +144,7 @@ U8 e_type_kind_basic_byte_size_table[61] =
0,
};
String8 e_expr_kind_strings[48] =
String8 e_expr_kind_strings[49] =
{
str8_lit_comp("Nil"),
str8_lit_comp("Ref"),
@@ -193,10 +193,11 @@ str8_lit_comp("TypeIdent"),
str8_lit_comp("Ptr"),
str8_lit_comp("Array"),
str8_lit_comp("Func"),
str8_lit_comp("Unsigned"),
str8_lit_comp("Define"),
};
E_OpInfo e_expr_kind_op_info_table[48] =
E_OpInfo e_expr_kind_op_info_table[49] =
{
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
@@ -245,6 +246,7 @@ E_OpInfo e_expr_kind_op_info_table[48] =
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
{ E_OpKind_Null, 0, str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
{ E_OpKind_Null, 0, str8_lit_comp("unsigned "), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("") },
{ E_OpKind_Binary, 13, str8_lit_comp(""), str8_lit_comp(" = "), str8_lit_comp(""), str8_lit_comp("") },
};
+3 -2
View File
@@ -145,6 +145,7 @@ E_ExprKind_TypeIdent,
E_ExprKind_Ptr,
E_ExprKind_Array,
E_ExprKind_Func,
E_ExprKind_Unsigned,
E_ExprKind_Define,
E_ExprKind_COUNT,
} E_ExprKindEnum;
@@ -169,8 +170,8 @@ C_LINKAGE_BEGIN
extern String8 e_token_kind_strings[6];
extern String8 e_type_kind_basic_string_table[61];
extern U8 e_type_kind_basic_byte_size_table[61];
extern String8 e_expr_kind_strings[48];
extern E_OpInfo e_expr_kind_op_info_table[48];
extern String8 e_expr_kind_strings[49];
extern E_OpInfo e_expr_kind_op_info_table[49];
extern String8 e_interpretation_code_display_strings[11];
C_LINKAGE_END