Jeremy Siek 3 anni fa
parent
commit
1fe01dd440
1 ha cambiato i file con 42 aggiunte e 42 eliminazioni
  1. 42 42
      book.tex

+ 42 - 42
book.tex

@@ -1664,7 +1664,7 @@ Appendix~\ref{appendix:utilities}.\\
 \fi}
 % TODO: python version of testing the PE
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Create three programs in the \LangInt{} language and test whether
   partially evaluating them with \code{pe\_Lint} and then
   interpreting them with \code{interp\_Lint} gives the same result
@@ -3039,7 +3039,7 @@ produce a new list.\index{subject}{for/list}
 \end{figure}
 
 \begin{exercise}
-\normalfont % I don't like the italics for exercises. -Jeremy
+\normalfont\normalsize % I don't like the italics for exercises. -Jeremy
 
 Complete the \code{uniquify} pass by filling in the blanks in
 Figure~\ref{fig:uniquify-Lvar}, that is, implement the cases for
@@ -3048,7 +3048,7 @@ in the support code.
 \end{exercise}
 
 \begin{exercise}
-\normalfont % I don't like the italics for exercises. -Jeremy
+\normalfont\normalsize
 \label{ex:Lvar}
 
 Create five \LangVar{} programs that exercise the most interesting
@@ -3330,7 +3330,7 @@ print(b)
 \end{center}
 
 \begin{exercise}
-  \normalfont
+  \normalfont\normalsize
 {\if\edition\racketEd  
 Implement the \code{remove\_complex\_operands} function in
 \code{compiler.rkt}.
@@ -3361,7 +3361,7 @@ intermediate programs, place \lstinline{(debug-level 1)} before the call to
 
 {\if\edition\pythonEd
 \begin{exercise}
-\normalfont % I don't like the italics for exercises. -Jeremy
+\normalfont\normalsize
 \label{ex:Lvar}
 
 Create five \LangVar{} programs that exercise the most interesting
@@ -3496,7 +3496,7 @@ This code organization is also related to continuation-passing style,
 except that \code{cont} is not what happens next during compilation,
 but what happens next in the generated code.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Implement the \code{explicate\_control} function in
 \code{compiler.rkt}.  Create three new \LangInt{} programs that
@@ -3647,7 +3647,7 @@ compiler portable across Linus and Mac OS X, which requires an underscore prefix
 all labels.
 \fi}
 \begin{exercise}
-  \normalfont
+  \normalfont\normalsize
 {\if\edition\racketEd
 Implement the \code{select\_instructions} pass in
 \code{compiler.rkt}. Create three new example programs that are
@@ -3750,7 +3750,7 @@ multiple of 16 bytes.\index{subject}{frame}
 
 % TODO: store the number of variables instead? -Jeremy
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Implement the \code{assign\_homes} pass in
 \racket{\code{compiler.rkt}}\python{\code{compiler.py}}, defining
 auxiliary functions for each of the non-terminals in the \LangXVar{}
@@ -3826,7 +3826,7 @@ from \key{rax} to the destination location, as follows.
 \end{lstlisting}
 
 \begin{exercise}
-\normalfont Implement the \key{patch\_instructions} pass in
+\normalfont\normalsize Implement the \key{patch\_instructions} pass in
 \racket{\code{compiler.rkt}}\python{\code{compiler.py}}.
 Create three new example programs that are
 designed to exercise all of the interesting cases in this pass.
@@ -3866,7 +3866,7 @@ all labels, e.g., changing \key{main} to \key{\_main}.
   function that returns \code{'Linux'}, \code{'Windows'}, or
   \code{'Darwin'} (for Mac).}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Implement the \key{prelude\_and\_conclusion} pass in
 \racket{\code{compiler.rkt}}\python{\code{compiler.py}}.
@@ -3909,7 +3909,7 @@ adapting and improving the partial evaluator for \LangInt{} that was
 introduced in Section~\ref{sec:partial-evaluation}.
 
 \begin{exercise}\label{ex:pe-Lvar}
-\normalfont
+\normalfont\normalsize
   
 Adapt the partial evaluator from Section~\ref{sec:partial-evaluation}
 (Figure~\ref{fig:pe-arith}) so that it applies to \LangVar{} programs
@@ -3920,9 +3920,9 @@ instead of \LangInt{} programs. Recall that \LangVar{} adds variables and
 to the \LangInt{} language, so you will need to add cases for them in
 the \code{pe\_exp}
 %
-\racket{function}
+\racket{function.}
 %
-\python{and \code{pe\_stmt} functions}.
+\python{and \code{pe\_stmt} functions.}
 %
 Once complete, add the partial evaluation pass to the front of your
 compiler and make sure that your compiler still passes all of the
@@ -3930,7 +3930,7 @@ tests.
 \end{exercise}
 
 \begin{exercise}
-\normalfont
+\normalfont\normalsize
 
 Improve on the partial evaluator by replacing the \code{pe\_neg} and
 \code{pe\_add} auxiliary functions with functions that know more about
@@ -4482,7 +4482,7 @@ L_{\mathsf{after}}(5)=  \emptyset
 \label{fig:liveness-example-0}
 \end{figure}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Perform liveness analysis on the running example in
   Figure~\ref{fig:reg-eg}, computing the live-before and live-after
   sets for each instruction. Compare your answers to the solution
@@ -4556,7 +4556,7 @@ L_{\mathsf{after}}(5)=  \emptyset
 \label{fig:live-eg}
 \end{figure}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Implement the \code{uncover\_live} \racket{pass}\python{function}.
   %
 \racket{Store the sequence of live-after sets in the $\itm{info}$
@@ -4832,7 +4832,7 @@ shown in Figure~\ref{fig:interfere}.
 %% the set of adjacent vertices, and the sets are represented using
 %% Racket's \key{set}, which is also a hash table.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 \racket{Implement the compiler pass named \code{build\_interference} according
 to the algorithm suggested above. We recommend using the Racket
   \code{graph} package to create and inspect the interference graph.
@@ -5547,7 +5547,7 @@ callq print_int
 \fi}
 \end{center}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Implement the compiler pass \code{allocate\_registers}.
 %
@@ -5659,7 +5659,7 @@ callq print_int
 \fi}
 \end{center}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Update the \code{patch\_instructions} compiler pass to delete trivial moves.
 %
@@ -5835,7 +5835,7 @@ main:
 \label{fig:running-example-x86}
 \end{figure}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Update the \code{prelude\_and\_conclusion} pass as described in this section.
 %
 \racket{
@@ -6318,7 +6318,7 @@ callq print_int
 \end{minipage}
 \fi}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Change your implementation of \code{allocate\_registers} to take move
 biasing into account. Create two new tests that include at least one
 opportunity for move biasing and visually inspect the output x86
@@ -7201,7 +7201,7 @@ The condition of an \code{if} must
 be of \BOOLTY{} type and the two branches must have the same type.
 
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Create 10 new test programs in \LangIf{}. Half of the programs should
 have a type error. For those programs, create an empty file with the
 same base name but with file extension \code{.tyerr}. For example, if
@@ -7617,7 +7617,7 @@ instead of just one (\code{subq}).
 %% memory, which is the primary factor that determines execution time on
 %% modern computer architectures.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Implement the pass \code{shrink} to remove \key{and} and \key{or} from
 the language by translating them to \code{if} expressions in \LangIf{}.
@@ -7647,7 +7647,7 @@ Run the script to test your compiler on all the test programs.
 Add cases to \code{uniquify\_exp} to handle Boolean constants and
 \code{if} expressions.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Update the \code{uniquify\_exp} for \LangIf{} and add the following
 entry to the list of \code{passes} in the \code{run-tests.rkt} script.
 \begin{lstlisting}
@@ -7737,7 +7737,7 @@ Atm &::=& \gray{ \INT{\Int} \MID \VAR{\Var} } \MID \BOOL{\itm{bool}}\\
 \end{figure}
 
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Add cases for Boolean constants and \code{if} to the \code{rco\_atom}
 and \code{rco\_exp} functions in \code{compiler.rkt}.
@@ -8525,7 +8525,7 @@ block39:
 \end{center}
 \fi}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 \racket{
 Implement the pass \code{explicate\_control} by adding the cases for
 Boolean constants and \key{if} to the \code{explicate\_tail} and
@@ -8657,7 +8657,7 @@ above but use different suffixes for the conditional jump instruction.
   as an assignment to the \key{rax} register followed by a jump to the
   conclusion of the \code{main} function.}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Expand your \code{select\_instructions} pass to handle the new
 features of the \LangIf{} language.
 %
@@ -8774,7 +8774,7 @@ instruction's argument and for computing the variables read-from ($R$)
 or written-to ($W$) by an instruction need to be updated to handle the
 new kinds of arguments and instructions in \LangXIfVar{}.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 {\if\edition\racketEd
 %
 Update the \code{uncover\_live} pass to apply liveness analysis to
@@ -8814,7 +8814,7 @@ Some instructions, e.g., the \key{movzbq} instruction, require special care,
 similar to the \key{movq} instruction. See rule number 1 in
 Section~\ref{sec:build-interference}.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Update the \code{build\_interference} pass for \LangXIfVar{}.
 {\if\edition\racketEd
 Add the following entries to the list of \code{passes} in the
@@ -8843,7 +8843,7 @@ one memory reference.
 %
 The second argument of the \key{movzbq} must be a register.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Update \code{patch\_instructions} pass for \LangXIfVar{}.
 %  
@@ -9434,7 +9434,7 @@ block_1:
 %% each block in the program, updating the target of every \code{goto}
 %% according to the mapping in \code{short-cut}.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Implement the improvements to the \code{explicate\_control} pass.
   Check that it removes trivial blocks in a few example programs. Then
   check that your compiler still passes all of your tests.
@@ -9542,7 +9542,7 @@ block_2:
 \label{fig:remove-jumps}
 \end{figure}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 %
 Implement a pass named \code{remove\_jumps} that merges basic blocks
 into their preceding basic block, when there is only one preceding
@@ -12519,7 +12519,7 @@ mark. The following example uses \code{set-point-x!} to change the
 \end{lstlisting}
 \end{center}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Create a type checker for \LangStruct{} by extending the type
   checker for \LangVec{}. Extend your compiler with support for simple
   structures, compiling \LangStruct{} to x86 assembly code. Create
@@ -12850,7 +12850,7 @@ Finally, the instructions for \code{any-vectorof-length} should be
 similar to those for \code{vectorof-length}, except that one must
 first project the array by writing zeroes into the $3$-bit tag
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 
 Implement a compiler for the \LangArray{} language by extending your
 compiler for \LangLoop{}. Test your compiler on a half dozen new
@@ -12929,7 +12929,7 @@ be added to the set. Also, if the value being overwritten was a
 pointer into the new generation, then that pointer should be removed
 from the set.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Adapt the \code{collect} function in \code{runtime.c} to implement
   generational garbage collection, as outlined in this section.
   Update the code generation for \code{vector-set!} to implement
@@ -14391,7 +14391,7 @@ The conclusion of every function should do the following.
 \end{enumerate}
 
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Expand your compiler to handle \LangFun{} as outlined in this chapter.
 Create 5 new programs that use functions, including examples that pass
 functions and return functions from other functions, recursive
@@ -15891,7 +15891,7 @@ def main() -> int:
 \label{fig:lexical-functions-example}
 \end{figure}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Expand your compiler to handle \LangLam{} as outlined in this chapter.
 Create 5 new programs that use \key{lambda} functions and make use of
 lexical scoping. Test your compiler on these new programs and all of
@@ -16181,7 +16181,7 @@ operator in a direct call, then we say that the function
 \emph{escapes}. If a global function does not escape, then we do not
 need to perform closure conversion on the function.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Implement an auxiliary function for detecting which global
   functions escape. Using that function, implement an improved version
   of closure conversion that does not apply closure conversion to
@@ -16278,7 +16278,7 @@ a \racket{\code{let}}\python{assignment}, mapping the variable to the
 name of the global function for the closure. This pass should come
 after closure conversion.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Implement a compiler pass, named \code{optimize\_known\_calls}, that
 compiles known calls into direct calls. Verify that your compiler is
 successful in this regard on several example programs.
@@ -18124,7 +18124,7 @@ other kinds of values.
 %% programs.
 %% \end{exercise}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
 Expand your compiler to handle \LangDyn{} as outlined in this chapter.
 Create tests for \LangDyn{} by adapting ten of your previous test programs
 by removing type annotations. Add 5 more tests programs that
@@ -19260,7 +19260,7 @@ movq %rax, |$\itm{lhs'}$|
 The \code{any-vector-set!} and \code{any-vector-length} operators can
 be translated in a similar way.
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Implement a compiler for the gradually-typed \LangGrad{} language by
   extending and adapting your compiler for \LangLoop{}. Create 10 new
   partially-typed test programs. In addition to testing with these
@@ -19944,7 +19944,7 @@ annotations and the body.
 (Def |$f$| ([|$x_1$| : |$T'_1$|] |$\ldots$|) |$T'_r$| |$\itm{info}$| |$e'$|)
 \end{lstlisting}
 
-\begin{exercise}\normalfont
+\begin{exercise}\normalfont\normalsize
   Implement a compiler for the polymorphic language \LangPoly{} by
   extending and adapting your compiler for \LangGrad{}. Create 6 new test
   programs that use polymorphic functions. Some of them should make