|
@@ -10359,9 +10359,9 @@ Although Python does not provide direct support for lazy evaluation, it
|
|
is easy to mimic. We can \emph{delay} the evaluation of a computation
|
|
is easy to mimic. We can \emph{delay} the evaluation of a computation
|
|
by wrapping it inside a function with no parameters. We can
|
|
by wrapping it inside a function with no parameters. We can
|
|
\emph{force} its evaluation by calling the function. However, we might
|
|
\emph{force} its evaluation by calling the function. However, we might
|
|
-need to force multiple times, so we should memoize the result of
|
|
|
|
-calling the function. The following \code{Promise} class handles
|
|
|
|
-this memoization.
|
|
|
|
|
|
+need to force multiple times, so we should store the result of
|
|
|
|
+calling the function instead of recomputing the result each time.
|
|
|
|
+The following \code{Promise} class handles this memoization.
|
|
%
|
|
%
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
@dataclass
|
|
@dataclass
|
|
@@ -11023,7 +11023,7 @@ The $\VOID{}$ expression produces the \code{\#<void>} value.
|
|
{\if\edition\pythonEd\pythonColor
|
|
{\if\edition\pythonEd\pythonColor
|
|
%
|
|
%
|
|
We add a new case for \code{While} in the \code{interp\_stmts}
|
|
We add a new case for \code{While} in the \code{interp\_stmts}
|
|
-function, where we repeatedly interpret the \code{body} so long as the
|
|
|
|
|
|
+function, in which we repeatedly interpret the \code{body} so long as the
|
|
\code{test} expression remains true.
|
|
\code{test} expression remains true.
|
|
%
|
|
%
|
|
\fi}
|
|
\fi}
|
|
@@ -11167,8 +11167,8 @@ class TypeCheckLwhile(TypeCheckLif):
|
|
At first glance, the translation of these language features to x86
|
|
At first glance, the translation of these language features to x86
|
|
seems straightforward because the \LangCIf{} intermediate language
|
|
seems straightforward because the \LangCIf{} intermediate language
|
|
already supports all the ingredients that we need: assignment,
|
|
already supports all the ingredients that we need: assignment,
|
|
-\code{goto}, conditional branching, and sequencing. However, there are
|
|
|
|
-complications that arise, which we discuss in the next section. After
|
|
|
|
|
|
+\code{goto}, conditional branching, and sequencing. However,
|
|
|
|
+complications arise, which we discuss in the next section. After
|
|
that we introduce the changes necessary to the existing passes.
|
|
that we introduce the changes necessary to the existing passes.
|
|
%
|
|
%
|
|
\fi}
|
|
\fi}
|
|
@@ -11864,7 +11864,7 @@ other two have result type \code{Void}.
|
|
{\if\edition\pythonEd\pythonColor
|
|
{\if\edition\pythonEd\pythonColor
|
|
%
|
|
%
|
|
The output of this pass is the language \LangCIf{}. No new language
|
|
The output of this pass is the language \LangCIf{}. No new language
|
|
-features are needed in the output because a \code{while} loop can be
|
|
|
|
|
|
+features are needed in the output, because a \code{while} loop can be
|
|
expressed in terms of \code{goto} and \code{if} statements, which are
|
|
expressed in terms of \code{goto} and \code{if} statements, which are
|
|
already in \LangCIf{}.
|
|
already in \LangCIf{}.
|
|
%
|
|
%
|
|
@@ -11917,7 +11917,7 @@ The \code{analyze\_dataflow} function has the following four parameters.
|
|
\racket{Also, as a side effect, it should update the block's
|
|
\racket{Also, as a side effect, it should update the block's
|
|
$\itm{info}$ with the liveness information for each instruction.}
|
|
$\itm{info}$ with the liveness information for each instruction.}
|
|
%
|
|
%
|
|
- \python{Also, as a side-effect, it should update the live-before and
|
|
|
|
|
|
+ \python{Also, as a side effect, it should update the live-before and
|
|
live-after sets for each instruction.}
|
|
live-after sets for each instruction.}
|
|
%
|
|
%
|
|
To implement the \code{transfer} function, you should be able to
|
|
To implement the \code{transfer} function, you should be able to
|
|
@@ -11929,7 +11929,7 @@ The \code{analyze\_dataflow} function has the following four parameters.
|
|
\end{enumerate}
|
|
\end{enumerate}
|
|
|
|
|
|
|
|
|
|
-\begin{figure}[p]
|
|
|
|
|
|
+\begin{figure}[tp]
|
|
\begin{tcolorbox}[colback=white]
|
|
\begin{tcolorbox}[colback=white]
|
|
{\if\edition\racketEd
|
|
{\if\edition\racketEd
|
|
\begin{tikzpicture}[baseline=(current bounding box.center),scale=0.90]
|
|
\begin{tikzpicture}[baseline=(current bounding box.center),scale=0.90]
|