Closed rundong08 closed 3 years ago
Consider the following input program
(let ([x (+ 42 (- 10))])
(+ x 10))
Our reference compiler produces the following output from remove-complex-opera*
:
(let ([x88924 (let ([tmp88925 (- 10)])
(+ 42 tmp88925))])
(+ x88924 10))
While it is certainly possible for us to instead float the let-bindings for temporaries up
to the top during remove-complex-opera*
, we instead choose to accomplish that task
in the explicate-control
pass.
Ah, I see. Thanks for the explanation!
Consider the following example in
R_{Var}
From the description of
rco-exp
andrco-atom
, it appears that the book wanted the following translation toR_{Var}^{ANF}
:However, there is another way to do this:
which I believe is also a valid
R_{Var}^{ANF}
program. But I feelCode 2
is harder to evaluate, which would need a stack, whileCode 1
can be evaluated without a stack.Should we restrict the
R_{Var}^{ANF}
such thatCode 1
is valid butCode 2
is invalid, for example, by not allowinge
in(Let x e body)
to contain anyLet
expression?