Jeremy Siek 4 年之前
父节点
当前提交
c03f004bbb
共有 1 个文件被更改,包括 21 次插入21 次删除
  1. 21 21
      book.tex

+ 21 - 21
book.tex

@@ -1157,8 +1157,8 @@ approximately 500 lines of code.
 
 
 The \LangVar{} language extends the \LangInt{} language with variable
 The \LangVar{} language extends the \LangInt{} language with variable
 definitions.  The concrete syntax of the \LangVar{} language is defined by
 definitions.  The concrete syntax of the \LangVar{} language is defined by
-the grammar in Figure~\ref{fig:r1-concrete-syntax} and the abstract
-syntax is defined in Figure~\ref{fig:r1-syntax}.  The non-terminal
+the grammar in Figure~\ref{fig:Rvar-concrete-syntax} and the abstract
+syntax is defined in Figure~\ref{fig:Rvar-syntax}.  The non-terminal
 \Var{} may be any Racket identifier. As in \LangInt{}, \key{read} is a
 \Var{} may be any Racket identifier. As in \LangInt{}, \key{read} is a
 nullary operator, \key{-} is a unary operator, and \key{+} is a binary
 nullary operator, \key{-} is a unary operator, and \key{+} is a binary
 operator.  Similar to \LangInt{}, the abstract syntax of \LangVar{} includes the
 operator.  Similar to \LangInt{}, the abstract syntax of \LangVar{} includes the
@@ -1184,7 +1184,7 @@ exhibit several compilation techniques.
 \end{minipage}
 \end{minipage}
 }
 }
 \caption{The concrete syntax of \LangVar{}.}
 \caption{The concrete syntax of \LangVar{}.}
-\label{fig:r1-concrete-syntax}
+\label{fig:Rvar-concrete-syntax}
 \end{figure}
 \end{figure}
 
 
 \begin{figure}[tp]
 \begin{figure}[tp]
@@ -1202,14 +1202,14 @@ exhibit several compilation techniques.
 \end{minipage}
 \end{minipage}
 }
 }
 \caption{The abstract syntax of \LangVar{}.}
 \caption{The abstract syntax of \LangVar{}.}
-\label{fig:r1-syntax}
+\label{fig:Rvar-syntax}
 \end{figure}
 \end{figure}
 
 
 Let us dive further into the syntax and semantics of the \LangVar{}
 Let us dive further into the syntax and semantics of the \LangVar{}
 language.  The \key{let} feature defines a variable for use within its
 language.  The \key{let} feature defines a variable for use within its
 body and initializes the variable with the value of an expression.
 body and initializes the variable with the value of an expression.
 The abstract syntax for \key{let} is defined in
 The abstract syntax for \key{let} is defined in
-Figure~\ref{fig:r1-syntax}.  The concrete syntax for \key{let} is
+Figure~\ref{fig:Rvar-syntax}.  The concrete syntax for \key{let} is
 \begin{lstlisting}
 \begin{lstlisting}
 (let ([|$\itm{var}$| |$\itm{exp}$|]) |$\itm{exp}$|)
 (let ([|$\itm{var}$| |$\itm{exp}$|]) |$\itm{exp}$|)
 \end{lstlisting}
 \end{lstlisting}
@@ -2126,11 +2126,12 @@ right.
 \]
 \]
 \end{minipage}
 \end{minipage}
 }
 }
-\caption{\LangVarANF{} is \LangVar{} in administrative normal form (ANF).}
-\label{fig:r1-anf-syntax}
+\caption{\LangVarANF{} is \LangVar{} with operands restricted to
+   atomic expressions, like administrative normal form (ANF).}
+\label{fig:Rvar-anf-syntax}
 \end{figure}
 \end{figure}
 
 
-Figure~\ref{fig:r1-anf-syntax} presents the grammar for the output of
+Figure~\ref{fig:Rvar-anf-syntax} presents the grammar for the output of
 this pass, the language \LangVarANF{}. The only difference is that
 this pass, the language \LangVarANF{}. The only difference is that
 operator arguments are restricted to be atomic expressions that are
 operator arguments are restricted to be atomic expressions that are
 defined by the \Atm{} non-terminal. In particular, integer constants
 defined by the \Atm{} non-terminal. In particular, integer constants
@@ -2290,13 +2291,16 @@ start:
 \end{figure}
 \end{figure}
 
 
 The organization of this pass depends on the notion of tail position
 The organization of this pass depends on the notion of tail position
-that we have alluded to earlier. Formally, \emph{tail
-  position}\index{subject}{tail position} for the language \LangVar{} is
-defined recursively by the following two rules.
+that we have alluded to earlier.
+
+\begin{definition}
+  The following rules define when an expression is in \textbf{\emph{tail
+  position}}\index{subject}{tail position} for the language \LangVar{}.
 \begin{enumerate}
 \begin{enumerate}
 \item In $\PROGRAM{\code{()}}{e}$, expression $e$ is in tail position.
 \item In $\PROGRAM{\code{()}}{e}$, expression $e$ is in tail position.
 \item If $\LET{x}{e_1}{e_2}$ is in tail position, then so is $e_2$.
 \item If $\LET{x}{e_1}{e_2}$ is in tail position, then so is $e_2$.
 \end{enumerate}
 \end{enumerate}
+\end{definition}
 
 
 We recommend implementing \code{explicate-control} using two mutually
 We recommend implementing \code{explicate-control} using two mutually
 recursive functions, \code{explicate-tail} and
 recursive functions, \code{explicate-tail} and
@@ -2312,17 +2316,13 @@ Figure~\ref{fig:c0-syntax}).
 %
 %
 The \code{explicate-assign} function takes an \Exp{} in \LangVar{},
 The \code{explicate-assign} function takes an \Exp{} in \LangVar{},
 the variable that it is to be assigned to, and a \Tail{} in
 the variable that it is to be assigned to, and a \Tail{} in
-\LangCVar{} for the code that will come after the assignment.  The
+\LangCVar{} for the code that comes after the assignment.  The
 \code{explicate-assign} function returns a $\Tail$ in \LangCVar{}.
 \code{explicate-assign} function returns a $\Tail$ in \LangCVar{}.
 
 
-The \code{explicate-assign} function is in accumulator-passing style
-in that the \code{cont} parameter is used for accumulating the
-output. The reader might be tempted to instead organize
-\code{explicate-assign} in a more direct fashion, without the
-\code{cont} parameter and perhaps using \code{append} to combine
-statements. We warn against that alternative because the
-accumulator-passing style is key to how we generate high-quality code
-for conditional expressions in Chapter~\ref{ch:Rif}.
+The \code{explicate-assign} function is in accumulator-passing style:
+the \code{cont} parameter is used for accumulating the output. This
+accumulator-passing style plays an important role in how we generate
+high-quality code for conditional expressions in Chapter~\ref{ch:Rif}.
 
 
 \begin{exercise}\normalfont
 \begin{exercise}\normalfont
 %
 %
@@ -4502,7 +4502,7 @@ Section~\ref{sec:type-check-Rif}.
 \end{minipage}
 \end{minipage}
 }
 }
 \caption{The concrete syntax of \LangIf{}, extending \LangVar{}
 \caption{The concrete syntax of \LangIf{}, extending \LangVar{}
-  (Figure~\ref{fig:r1-concrete-syntax}) with Booleans and conditionals.}
+  (Figure~\ref{fig:Rvar-concrete-syntax}) with Booleans and conditionals.}
 \label{fig:Rif-concrete-syntax}
 \label{fig:Rif-concrete-syntax}
 \end{figure}
 \end{figure}