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
+49 -48
View File
@@ -82,63 +82,64 @@ E_TypeKindTable:
@table(name op_kind precedence op_pre op_sep op_pos op_chain)
E_ExprKindTable:
{
{ Nil Null 0 "" "" "" "" }
{ Ref Null 0 "" "" "" "" }
{ Nil Null 0 "" "" "" "" }
{ Ref Null 0 "" "" "" "" }
{ ArrayIndex Null 0 "" "[" "]" "" }
{ MemberAccess Null 0 "" "." "" "" }
{ Deref UnaryPrefix 2 "*" "" "" "" }
{ Address UnaryPrefix 2 "&" "" "" "" }
{ ArrayIndex Null 0 "" "[" "]" "" }
{ MemberAccess Null 0 "" "." "" "" }
{ Deref UnaryPrefix 2 "*" "" "" "" }
{ Address UnaryPrefix 2 "&" "" "" "" }
{ Cast Null 1 "(" ")" "" "" }
{ Sizeof UnaryPrefix 1 "sizeof" "(" ")" "" }
{ Typeof UnaryPrefix 1 "typeof" "(" ")" "" }
{ ByteSwap UnaryPrefix 1 "bswap" "(" ")" "" }
{ Cast Null 1 "(" ")" "" "" }
{ Sizeof UnaryPrefix 1 "sizeof" "(" ")" "" }
{ Typeof UnaryPrefix 1 "typeof" "(" ")" "" }
{ ByteSwap UnaryPrefix 1 "bswap" "(" ")" "" }
{ Pos UnaryPrefix 2 "+" "" "" "" }
{ Neg UnaryPrefix 2 "-" "" "" "" }
{ LogNot UnaryPrefix 2 "!" "" "" "" }
{ BitNot UnaryPrefix 2 "~" "" "" "" }
{ Mul Binary 3 "" " * " "" "" }
{ Div Binary 3 "" " / " "" "" }
{ Mod Binary 3 "" " % " "" "" }
{ Add Binary 4 "" " + " "" "" }
{ Sub Binary 4 "" " - " "" "" }
{ LShift Binary 5 "" " << " "" "" }
{ RShift Binary 5 "" " >> " "" "" }
{ Less Binary 6 "" " < " "" "" }
{ LsEq Binary 6 "" " <= " "" "" }
{ Grtr Binary 6 "" " > " "" "" }
{ GrEq Binary 6 "" " >= " "" "" }
{ EqEq Binary 7 "" " == " "" "" }
{ NtEq Binary 7 "" " != " "" "" }
{ Pos UnaryPrefix 2 "+" "" "" "" }
{ Neg UnaryPrefix 2 "-" "" "" "" }
{ LogNot UnaryPrefix 2 "!" "" "" "" }
{ BitNot UnaryPrefix 2 "~" "" "" "" }
{ Mul Binary 3 "" " * " "" "" }
{ Div Binary 3 "" " / " "" "" }
{ Mod Binary 3 "" " % " "" "" }
{ Add Binary 4 "" " + " "" "" }
{ Sub Binary 4 "" " - " "" "" }
{ LShift Binary 5 "" " << " "" "" }
{ RShift Binary 5 "" " >> " "" "" }
{ Less Binary 6 "" " < " "" "" }
{ LsEq Binary 6 "" " <= " "" "" }
{ Grtr Binary 6 "" " > " "" "" }
{ GrEq Binary 6 "" " >= " "" "" }
{ EqEq Binary 7 "" " == " "" "" }
{ NtEq Binary 7 "" " != " "" "" }
{ BitAnd Binary 8 "" " & " "" "" }
{ BitXor Binary 9 "" " ^ " "" "" }
{ BitOr Binary 10 "" " | " "" "" }
{ LogAnd Binary 11 "" " && " "" "" }
{ LogOr Binary 12 "" " || " "" "" }
{ BitAnd Binary 8 "" " & " "" "" }
{ BitXor Binary 9 "" " ^ " "" "" }
{ BitOr Binary 10 "" " | " "" "" }
{ LogAnd Binary 11 "" " && " "" "" }
{ LogOr Binary 12 "" " || " "" "" }
{ Ternary Null 0 "" " ? " " : " "" }
{ Ternary Null 0 "" " ? " " : " "" }
{ Call Null 15 "" "(" ")" ", "}
{ Call Null 15 "" "(" ")" ", "}
{ LeafBytecode Null 0 "" "" "" "" }
{ LeafStringLiteral Null 0 "" "" "" "" }
{ LeafU64 Null 0 "" "" "" "" }
{ LeafF64 Null 0 "" "" "" "" }
{ LeafF32 Null 0 "" "" "" "" }
{ LeafIdentifier Null 0 "" "" "" "" }
{ LeafOffset Null 0 "" "" "" "" }
{ LeafValue Null 0 "" "" "" "" }
{ LeafFilePath Null 0 "" "" "" "" }
{ LeafBytecode Null 0 "" "" "" "" }
{ LeafStringLiteral Null 0 "" "" "" "" }
{ LeafU64 Null 0 "" "" "" "" }
{ LeafF64 Null 0 "" "" "" "" }
{ LeafF32 Null 0 "" "" "" "" }
{ LeafIdentifier Null 0 "" "" "" "" }
{ LeafOffset Null 0 "" "" "" "" }
{ LeafValue Null 0 "" "" "" "" }
{ LeafFilePath Null 0 "" "" "" "" }
{ TypeIdent Null 0 "" "" "" "" }
{ Ptr Null 0 "" "" "" "" }
{ Array Null 0 "" "" "" "" }
{ Func Null 0 "" "" "" "" }
{ TypeIdent Null 0 "" "" "" "" }
{ Ptr Null 0 "" "" "" "" }
{ Array Null 0 "" "" "" "" }
{ Func Null 0 "" "" "" "" }
{ Unsigned Null 0 "unsigned " "" "" "" }
{ Define Binary 13 "" " = " "" "" }
{ Define Binary 13 "" " = " "" "" }
}
@table(name display_string)