浏览代码

typos, grammar, rephrasing

Peter Thiemann 3 年之前
父节点
当前提交
f7da3ca562
共有 1 个文件被更改,包括 24 次插入25 次删除
  1. 24 25
      book.tex

+ 24 - 25
book.tex

@@ -7127,7 +7127,7 @@ The type of a Boolean constant is \BOOLTY{}.
   an \INTTY{}. Negation requires its argument to be a \BOOLTY{} and
   an \INTTY{}. Negation requires its argument to be a \BOOLTY{} and
   produces a \BOOLTY{}. Similarly for logical and and logical or. }
   produces a \BOOLTY{}. Similarly for logical and and logical or. }
 %
 %
-The equality operators requires the two arguments to have the same
+The equality operators require the two arguments to have the same
 type.
 type.
 %
 %
 \python{The other comparisons (less-than, etc.) require their
 \python{The other comparisons (less-than, etc.) require their
@@ -7510,8 +7510,8 @@ are expressible using \code{if} as follows.
   \CAND{e_1}{e_2} & \quad \Rightarrow \quad \CIF{e_1}{e_2}{\FALSE{}}\\
   \CAND{e_1}{e_2} & \quad \Rightarrow \quad \CIF{e_1}{e_2}{\FALSE{}}\\
   \COR{e_1}{e_2} & \quad \Rightarrow \quad \CIF{e_1}{\TRUE{}}{e_2}
   \COR{e_1}{e_2} & \quad \Rightarrow \quad \CIF{e_1}{\TRUE{}}{e_2}
 \end{align*}
 \end{align*}
-By performing these translations in the front-end of the compiler, the
-later passes of the compiler do not need to deal with these features,
+By performing these translations in the front-end of the compiler,
+subsequent passes of the compiler do not need to deal with these features,
 making the passes shorter.
 making the passes shorter.
 
 
 %% For example, subtraction is
 %% For example, subtraction is
@@ -7604,7 +7604,7 @@ but the \code{if} expression is not.  All three sub-expressions of an
   branch) or false (for the ``else'' branch). The \code{Let} provides
   branch) or false (for the ``else'' branch). The \code{Let} provides
   a way to initialize the temporary variables within the two branches
   a way to initialize the temporary variables within the two branches
   of the \code{if} expression.  In general, the $\LET{x}{e_1}{e_2}$
   of the \code{if} expression.  In general, the $\LET{x}{e_1}{e_2}$
-  form assigns the result of $e_1$ to the variable $x$, an then
+  form assigns the result of $e_1$ to the variable $x$, and then
   evaluates $e_2$, which may reference $x$.}
   evaluates $e_2$, which may reference $x$.}
 
 
 Add cases for Boolean constants, \python{comparisons,} and \code{if}
 Add cases for Boolean constants, \python{comparisons,} and \code{if}
@@ -7731,7 +7731,7 @@ print(y + 2 if (x == 0 if x < 1 else x == 2) else y + 10)
 The naive way to compile \key{if} and the comparison operations would
 The naive way to compile \key{if} and the comparison operations would
 be to handle each of them in isolation, regardless of their context.
 be to handle each of them in isolation, regardless of their context.
 Each comparison would be translated into a \key{cmpq} instruction
 Each comparison would be translated into a \key{cmpq} instruction
-followed by a couple instructions to move the result from the EFLAGS
+followed by several instructions to move the result from the EFLAGS
 register into a general purpose register or stack location. Each
 register into a general purpose register or stack location. Each
 \key{if} would be translated into a \key{cmpq} instruction followed by
 \key{if} would be translated into a \key{cmpq} instruction followed by
 a conditional jump. The generated code for the inner \key{if} in the
 a conditional jump. The generated code for the inner \key{if} in the
@@ -7764,7 +7764,7 @@ For example, we want to generate the following code for the inner
 \end{lstlisting}
 \end{lstlisting}
 \end{minipage}
 \end{minipage}
 \end{center}
 \end{center}
-One way to achieve this is to reorganize the code at the level of
+One way to achieve this goal is to reorganize the code at the level of
 \LangIf{}, pushing the outer \key{if} inside the inner one, yielding
 \LangIf{}, pushing the outer \key{if} inside the inner one, yielding
 the following code.
 the following code.
 \begin{center}
 \begin{center}
@@ -8461,7 +8461,7 @@ We take the usual approach of encoding them as integers.
 \FALSE{} \quad\Rightarrow\quad \key{0}
 \FALSE{} \quad\Rightarrow\quad \key{0}
 \]
 \]
 
 
-For translating statements, we discuss a couple cases.  The \code{not}
+For translating statements, we discuss a selection of cases.  The \code{not}
 operation can be implemented in terms of \code{xorq} as we discussed
 operation can be implemented in terms of \code{xorq} as we discussed
 at the beginning of this section. Given an assignment, if the
 at the beginning of this section. Given an assignment, if the
 left-hand side variable is the same as the argument of \code{not},
 left-hand side variable is the same as the argument of \code{not},
@@ -8584,7 +8584,7 @@ the addition of \key{if} expressions to \LangIf{},
 %% \code{uncover\_live\_CFG} that applies liveness analysis to a
 %% \code{uncover\_live\_CFG} that applies liveness analysis to a
 %% control-flow graph.
 %% control-flow graph.
 
 
-The first question is: what order should we process the basic blocks?
+The first question is: in what order should we process the basic blocks?
 Recall that to perform liveness analysis on a basic block we need to
 Recall that to perform liveness analysis on a basic block we need to
 know the live-after set for the last instruction in the block. If a
 know the live-after set for the last instruction in the block. If a
 basic block has no successors (i.e. contains no jumps to other
 basic block has no successors (i.e. contains no jumps to other
@@ -8693,14 +8693,15 @@ program.
 \label{sec:build-interference-Lif}
 \label{sec:build-interference-Lif}
 
 
 Many of the new instructions in \LangXIfVar{} can be handled in the
 Many of the new instructions in \LangXIfVar{} can be handled in the
-same way as the instructions in \LangXVar{}. Thus, if your code was
-already quite general, it will not need to be changed to handle the
-new instructions. If you code is not general enough, we recommend that
-you change your code to be more general. For example, you can factor
-out the computing of the the read and write sets for each kind of
-instruction into auxiliary functions.
-
-Note that the \key{movzbq} instruction requires some special care,
+same way as the instructions in \LangXVar{}.
+% Thus, if your code was
+% already quite general, it will not need to be changed to handle the
+% new instructions. If your code is not general enough, we recommend that
+% you change your code to be more general. For example, you can factor
+% out the computing of the the read and write sets for each kind of
+% instruction into auxiliary functions.
+%
+Some instructions, e.g., the \key{movzbq} instruction, require special care,
 similar to the \key{movq} instruction. See rule number 1 in
 similar to the \key{movq} instruction. See rule number 1 in
 Section~\ref{sec:build-interference}.
 Section~\ref{sec:build-interference}.
 
 
@@ -9010,11 +9011,9 @@ this problem by modifying the \code{create\_block} function to
 recognize this situation.
 recognize this situation.
 
 
 Second, \code{explicate\_control} creates a basic block whenever a
 Second, \code{explicate\_control} creates a basic block whenever a
-continuation \emph{might} get used more than once (wheneven a
+continuation \emph{might} get used more than once (whenever a
 continuation is passed into two or more recursive calls). However,
 continuation is passed into two or more recursive calls). However,
-just because a continuation might get used more than once, doesn't
-mean it will.  In fact, some continuation parameters may not be used
-at all because we sometimes ignore them. For example, consider the
+some continuation parameters may not be used at all. For example, consider the
 case for the constant \TRUE{} in \code{explicate\_pred}, where we
 case for the constant \TRUE{} in \code{explicate\_pred}, where we
 discard the \code{els} branch.  So the question is how can we decide
 discard the \code{els} branch.  So the question is how can we decide
 whether to create a basic block?
 whether to create a basic block?
@@ -9051,9 +9050,9 @@ by wrapping it inside a function with no parameters. We can
 cases of \code{explicate\_pred}, etc., we will return a list of
 cases of \code{explicate\_pred}, etc., we will return a list of
 statements and in other cases we will return a function that computes
 statements and in other cases we will return a function that computes
 a list of statements. We use the term \emph{promise} to refer to a
 a list of statements. We use the term \emph{promise} to refer to a
-value that may or may not be delayed.  To uniformly deal with
+value that may be delayed.  To uniformly deal with
 promises, we define the following \code{force} function that checks
 promises, we define the following \code{force} function that checks
-whether its input is delayed (i.e. whether it is a function) and then
+whether its input is delayed (i.e., whether it is a function) and then
 either 1) calls the function, or 2) returns the input.
 either 1) calls the function, or 2) returns the input.
 \begin{lstlisting}
 \begin{lstlisting}
 def force(promise):
 def force(promise):
@@ -9099,7 +9098,7 @@ which we use to create a \code{goto}.
 \fi}
 \fi}
 {\if\edition\pythonEd
 {\if\edition\pythonEd
 %
 %
-Here's the new version of the \code{create\_block} auxiliary function
+Here is the new version of the \code{create\_block} auxiliary function
 that works on promises and that checks whether the block consists of a
 that works on promises and that checks whether the block consists of a
 solitary \code{goto} statement.\\
 solitary \code{goto} statement.\\
 \begin{minipage}{\textwidth}
 \begin{minipage}{\textwidth}
@@ -9459,7 +9458,7 @@ blocks on several test programs.
 \label{sec:cond-further-reading}
 \label{sec:cond-further-reading}
 
 
 The algorithm for the \code{explicate\_control} pass is based on the
 The algorithm for the \code{explicate\_control} pass is based on the
-the \code{explose-basic-blocks} pass in the course notes of
+\code{explose-basic-blocks} pass in the course notes of
 \citet{Dybvig:2010aa}.
 \citet{Dybvig:2010aa}.
 %
 %
 It has similarities to the algorithms of \citet{Danvy:2003fk} and
 It has similarities to the algorithms of \citet{Danvy:2003fk} and
@@ -17615,7 +17614,7 @@ be translated in a similar way.
   and tests for \LangDyn{}. Sometimes you may get a type checking error
   and tests for \LangDyn{}. Sometimes you may get a type checking error
   on the \LangDyn{} programs but you can adapt them by inserting
   on the \LangDyn{} programs but you can adapt them by inserting
   a cast to the \code{Any} type around each subexpression
   a cast to the \code{Any} type around each subexpression
-  causing a type error. While \LangDyn{} doesn't have explicit casts,
+  causing a type error. While \LangDyn{} does not have explicit casts,
   you can induce one by wrapping the subexpression \code{e}
   you can induce one by wrapping the subexpression \code{e}
   with a call to an un-annotated identity function, like this:
   with a call to an un-annotated identity function, like this:
   \code{((lambda (x) x) e)}.
   \code{((lambda (x) x) e)}.