|
@@ -9648,12 +9648,11 @@ Figure~\ref{fig:interp-Rwhile}.
|
|
{\if\edition\racketEd
|
|
{\if\edition\racketEd
|
|
%
|
|
%
|
|
We add new cases for \code{SetBang}, \code{WhileLoop}, \code{Begin},
|
|
We add new cases for \code{SetBang}, \code{WhileLoop}, \code{Begin},
|
|
-and \code{Void} and we make changes to the cases for \code{Var},
|
|
|
|
-\code{Let}, and \code{Apply} regarding variables. To support
|
|
|
|
-assignment to variables and to make their lifetimes indefinite (see
|
|
|
|
-the second example in Section~\ref{sec:assignment-scoping}), we box
|
|
|
|
-the value that is bound to each variable (in \code{Let}) and function
|
|
|
|
-parameter (in \code{Apply}). The case for \code{Var} unboxes the
|
|
|
|
|
|
+and \code{Void} and we make changes to the cases for \code{Var} and
|
|
|
|
+\code{Let} regarding variables. To support assignment to variables and
|
|
|
|
+to make their lifetimes indefinite (see the second example in
|
|
|
|
+Section~\ref{sec:assignment-scoping}), we box the value that is bound
|
|
|
|
+to each variable (in \code{Let}). The case for \code{Var} unboxes the
|
|
value.
|
|
value.
|
|
%
|
|
%
|
|
Now to discuss the new cases. For \code{SetBang}, we lookup the
|
|
Now to discuss the new cases. For \code{SetBang}, we lookup the
|
|
@@ -10314,8 +10313,7 @@ Figure~\ref{fig:Rwhile-anf-syntax} defines the output language
|
|
{\if\edition\racketEd
|
|
{\if\edition\racketEd
|
|
\[
|
|
\[
|
|
\begin{array}{rcl}
|
|
\begin{array}{rcl}
|
|
-\Atm &::=& \gray{ \INT{\Int} \MID \VAR{\Var} \MID \BOOL{\itm{bool}}
|
|
|
|
- \MID \VOID{} } \\
|
|
|
|
|
|
+\Atm &::=& \gray{ \INT{\Int} \MID \VAR{\Var} \MID \BOOL{\itm{bool}} } \MID \VOID{} \\
|
|
\Exp &::=& \ldots \MID \gray{ \LET{\Var}{\Exp}{\Exp} } \\
|
|
\Exp &::=& \ldots \MID \gray{ \LET{\Var}{\Exp}{\Exp} } \\
|
|
&\MID& \GETBANG{\Var}
|
|
&\MID& \GETBANG{\Var}
|
|
\MID \SETBANG{\Var}{\Exp} \\
|
|
\MID \SETBANG{\Var}{\Exp} \\
|
|
@@ -10409,17 +10407,15 @@ control-flow graphs of the later may contain cycles.
|
|
\small
|
|
\small
|
|
\[
|
|
\[
|
|
\begin{array}{lcl}
|
|
\begin{array}{lcl}
|
|
-\Stmt &::=& \gray{ \ASSIGN{\VAR{\Var}}{\Exp}
|
|
|
|
- \MID \LP\key{Collect} \,\itm{int}\RP } \\
|
|
|
|
- &\MID& \CALL{\Atm}{\LP\Atm\ldots\RP} \MID \READ{}\\
|
|
|
|
-% &\MID& \LP\key{Prim}~\key{'vector-set!}\,\LP\key{list}\,\Atm\,\INT{\Int}\,\Atm\RP\RP \\
|
|
|
|
|
|
+\Stmt &::=& \gray{ \ASSIGN{\VAR{\Var}}{\Exp} }
|
|
|
|
+ \MID \READ{}\\
|
|
\Def &::=& \DEF{\itm{label}}{\LP\LS\Var\key{:}\Type\RS\ldots\RP}{\Type}{\itm{info}}{\LP\LP\itm{label}\,\key{.}\,\Tail\RP\ldots\RP}\\
|
|
\Def &::=& \DEF{\itm{label}}{\LP\LS\Var\key{:}\Type\RS\ldots\RP}{\Type}{\itm{info}}{\LP\LP\itm{label}\,\key{.}\,\Tail\RP\ldots\RP}\\
|
|
-\LangCLoopM{} & ::= & \PROGRAMDEFS{\itm{info}}{\LP\Def\ldots\RP}
|
|
|
|
|
|
+\LangCLoopM{} & ::= & \CPROGRAM{\itm{info}}{\LP\LP\itm{label}\,\key{.}\,\Tail\RP\ldots\RP}
|
|
\end{array}
|
|
\end{array}
|
|
\]
|
|
\]
|
|
\end{minipage}
|
|
\end{minipage}
|
|
}
|
|
}
|
|
-\caption{The abstract syntax of \LangCLoop{}, extending \LangCLam{} (Figure~\ref{fig:c4-syntax}).}
|
|
|
|
|
|
+\caption{The abstract syntax of \LangCLoop{}, extending \LangCIf{} (Figure~\ref{fig:c1-syntax}).}
|
|
\label{fig:c7-syntax}
|
|
\label{fig:c7-syntax}
|
|
\end{figure}
|
|
\end{figure}
|
|
|
|
|