Closed iambrj closed 3 years ago
Dear Bharathi,
Thank you for your interest in Essentials of Compilation!
Consider the following example:
(let ([x 5]) (+ x 2))
The Var
struct represents uses of variables, such as x
in (+ x 2)
.
The x
in the (let ([x 5) ...)
is different, it is a binding site for x
,
or put another way, it is the definition of x
. In that context, the
symbol x
should be viewed as part of the Let
AST and not
a separate AST node.
Hope that helps! Jeremy
Hello! I would first like to thank you for making such a wonderful resource available for free.
While I was going through the code, I noticed that the contract for the Let struct restricts the variable binding to any arbitrary symbol instead of just
Var
structs. Ins't the latter choice more appropriate here?