Selaa lähdekoodia

more fixes from Eric

Jeremy Siek 6 vuotta sitten
vanhempi
commit
603cc6f6ca
1 muutettua tiedostoa jossa 20 lisäystä ja 18 poistoa
  1. 20 18
      book.tex

+ 20 - 18
book.tex

@@ -1894,7 +1894,7 @@ multiple of 16 bytes.
 \begin{exercise}
 \normalfont Implement the \key{assign-homes} pass and test it on all
 of the example programs that you created for the previous passes pass.
-I recommend that \key{assign-homes} take an extra parameter that is a
+We recommend that \key{assign-homes} take an extra parameter that is a
 mapping of variable names to homes (stack locations for now).  Use the
 \key{interp-tests} function (Appendix~\ref{appendix:utilities}) from
 \key{utilities.rkt} to test your passes on the example programs.
@@ -1945,23 +1945,25 @@ your passes on the example programs.
 \section{Print x86}
 \label{sec:print-x86}
 
-The last step of the compiler from $R_1$ to x86 is to convert the
-x86 AST (defined in Figure~\ref{fig:x86-ast-a}) to the string
+The last step of the compiler from $R_1$ to x86 is to convert the x86
+AST (defined in Figure~\ref{fig:x86-ast-a}) to the string
 representation (defined in Figure~\ref{fig:x86-a}). The Racket
 \key{format} and \key{string-append} functions are useful in this
 regard. The main work that this step needs to perform is to create the
-\key{main} function and the standard instructions for its prelude
-and conclusion, as shown in Figure~\ref{fig:p1-x86} of
-Section~\ref{sec:x86}. You need to know the number of
-stack-allocated variables, for which it is suggest that you compute in
-the \key{assign-homes} pass (Section~\ref{sec:assign-s0}) and store in
-the $\itm{info}$ field of the \key{program} node.
-
-Your compiled code should print the result of the program's execution by using the
-\code{print\_int} function provided in \code{runtime.c}. If your compiler has been implemented correctly so far, this final result should be stored in the \key{rax} register.
-We'll talk more about
-how to perform function calls with arguments in general later on, but
-for now, make sure that your x86 printer includes the following code as part of the conclusion:
+\key{main} function and the standard instructions for its prelude and
+conclusion, as shown in Figure~\ref{fig:p1-x86} of
+Section~\ref{sec:x86}. You need to know the number of stack-allocated
+variables, so we suggest computing it in the \key{assign-homes} pass
+(Section~\ref{sec:assign-s0}) and storing it in the $\itm{info}$ field
+of the \key{program} node.
+
+Your compiled code should print the result of the program's execution
+by using the \code{print\_int} function provided in
+\code{runtime.c}. If your compiler has been implemented correctly so
+far, this final result should be stored in the \key{rax} register.
+We'll talk more about how to perform function calls with arguments in
+general later on, but for now, make sure that your x86 printer
+includes the following code as part of the conclusion:
 
 \begin{lstlisting}
     movq %rax, %rdi
@@ -2204,9 +2206,9 @@ the live-after sets. We recommend storing the live-after sets (a list
 of lists of variables) in the $\itm{info}$ field of the \key{program}
 node alongside the list of variables as follows.
 \begin{lstlisting}
-   (program (|$\Var^{*}$| |$\itm{live{-}afters}$|) |$\Instr^{+}$|)
+   (program (|$\Var^{*}$| |$\itm{live}$-$\itm{afters}$|) |$\Instr^{+}$|)
 \end{lstlisting}
-I recommend organizing your code to use a helper function that takes a
+We recommend organizing your code to use a helper function that takes a
 list of statements and an initial live-after set (typically empty) and
 returns the list of statements and the list of live-after sets.  For
 this chapter, returning the list of statements is unnecessary, as they
@@ -2214,7 +2216,7 @@ will be unchanged, but in Chapter~\ref{ch:bool-types} we introduce
 \key{if} statements and will need to annotate them with the live-after
 sets of the two branches.
 
-I recommend creating helper functions to 1) compute the set of
+We recommend creating helper functions to 1) compute the set of
 variables that appear in an argument (of an instruction), 2) compute
 the variables read by an instruction which corresponds to the $R$
 function discussed above, and 3) the variables written by an