CSE machine: choice of ':' vs ':=' should be done when scanning out declarations and not when running asgn control instruction
Closed this issue · 0 comments
wpinrui commented
Currently, all names are initialised with :
, and asgn instructions are treated differently for const
and let
declarations.
When a let
declaration is evaluated, the value is bound to the name.
When a const
declaration is evaluated, the same happens but there is additionally a =
placed to the right of the :
.
Thus, in a program where a const
declaration never gets evaluated but its block is reached, we have the situation where the environment diagram indicates :
instead of :=
:
(https://share.sourceacademy.nus.edu.sg/n1012)[https://share.sourceacademy.nus.edu.sg/n1012]