You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to functions, we have a set of structs that the user defined.
struct A {
b: int,
c: bool
}
Type checking is fine, just check for existence inside this set. The set value contains information about the fields, and the type of the fields. For now null pointer is fine.
Then for evaluating: for example let h = a.b. We first evaluate a and put that in rax as a pointer (should be in symbol table at this point). That is evaluating the the id of the . infix operator.
Two ways of thinking about it.
Type check happens at compiler:
a evaluation returns the instructions and the type A
Then at the dot operator call, we have the type and we reference the types set to get the offset and type of b, and evaluate a load and whatever and return the type of b
Type check is a separate pass that already happens:
We need every IR expression (or maybe just ids?) to have a type in the struct that is passed in.
a evaluation returns the instructions
dot operator knows the type of 'a' by looking at struct, then can get the offset
The text was updated successfully, but these errors were encountered:
Implement custom structs.
Similar to functions, we have a set of structs that the user defined.
Type checking is fine, just check for existence inside this set. The set value contains information about the fields, and the type of the fields. For now null pointer is fine.
Then for evaluating: for example
let h = a.b
. We first evaluatea
and put that in rax as a pointer (should be in symbol table at this point). That is evaluating the the id of the.
infix operator.Two ways of thinking about it.
Type check happens at compiler:
a
evaluation returns the instructions and the type AType check is a separate pass that already happens:
We need every IR expression (or maybe just ids?) to have a type in the struct that is passed in.
a
evaluation returns the instructionsThe text was updated successfully, but these errors were encountered: