|
@@ -969,8 +969,8 @@ to give enough hints that the well-prepared reader, together with some
|
|
|
friends, can implement a compiler from $R_1$ to x86 in a couple weeks
|
|
|
while at the same time leaving room for some fun and creativity. To
|
|
|
give the reader a feeling for the scale of this first compiler, the
|
|
|
-instructor solution for the $R_1$ compiler is approximately 500 lines
|
|
|
-of code.
|
|
|
+instructor solution for the $R_1$ compiler is less than 500 lines of
|
|
|
+code.
|
|
|
|
|
|
\section{The $R_1$ Language}
|
|
|
\label{sec:s0}
|
|
@@ -1677,7 +1677,7 @@ $\Rightarrow$
|
|
|
\end{minipage}
|
|
|
\end{tabular}
|
|
|
|
|
|
-We recommend implementing \code{uniquify} using an auxiliary function
|
|
|
+We recommend implementing \code{uniquify} by creating a function named
|
|
|
\code{uniquify-exp} that is structurally recursive function and mostly
|
|
|
just copies the input program. However, when encountering a \key{let},
|
|
|
it should generate a unique name for the variable (the Racket function
|
|
@@ -1913,19 +1913,18 @@ recursive functions: \code{explicate-control-tail} and
|
|
|
\code{explicate-control-assign}. The \code{explicate-control-tail}
|
|
|
function should be applied to expressions in tail position whereas
|
|
|
\code{explicate-control-assign} should be applied to expressions that
|
|
|
-occur on the right-hand-side of a \key{let}. The function
|
|
|
+occur on the right-hand-side of a \key{let}.
|
|
|
\code{explicate-control-tail} takes an $R_1$ expression as input and
|
|
|
-produces a $C_0$ $\Tail$ (see the grammar in
|
|
|
-Figure~\ref{fig:c0-syntax}) and a list of formerly \key{let}-bound
|
|
|
-variables. The \code{explicate-control-assign} function takes an $R_1$
|
|
|
-expression, the variable that it is to be assigned to, and $C_0$ code
|
|
|
-(a $\Tail$) that should come after the assignment (e.g., the code
|
|
|
-generated for the body of the \key{let}). It returns a $\Tail$ and a
|
|
|
-list of variables. The top-level \code{explicate-control} function
|
|
|
-should invoke \code{explicate-control-tail} on the body of the
|
|
|
-\key{program} and then associate the \code{locals} symbol with the
|
|
|
-resulting list of variables in the $\itm{info}$ field, as in the above
|
|
|
-example.
|
|
|
+produces a $C_0$ $\Tail$ (see Figure~\ref{fig:c0-syntax}) and a list
|
|
|
+of formerly \key{let}-bound variables. The
|
|
|
+\code{explicate-control-assign} function takes an $R_1$ expression,
|
|
|
+the variable that it is to be assigned to, and $C_0$ code (a $\Tail$)
|
|
|
+that should come after the assignment (e.g., the code generated for
|
|
|
+the body of the \key{let}). It returns a $\Tail$ and a list of
|
|
|
+variables. The top-level \code{explicate-control} function should
|
|
|
+invoke \code{explicate-control-tail} on the body of the \key{program}
|
|
|
+and then associate the \code{locals} symbol with the resulting list of
|
|
|
+variables in the $\itm{info}$ field, as in the above example.
|
|
|
|
|
|
%% \section{Uncover Locals}
|
|
|
%% \label{sec:uncover-locals-r1}
|