Jeremy Siek 2 years ago
parent
commit
72854e9ede
1 changed files with 13 additions and 10 deletions
  1. 13 10
      book.tex

+ 13 - 10
book.tex

@@ -26,7 +26,7 @@
 
 
 \def\racketEd{0}
 \def\racketEd{0}
 \def\pythonEd{1}
 \def\pythonEd{1}
-\def\edition{0}
+\def\edition{1}
 
 
 % material that is specific to the Racket edition of the book
 % material that is specific to the Racket edition of the book
 \newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
 \newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
@@ -269,10 +269,10 @@ concepts and algorithms used in compilers.
   point the input languages are statically typed.  The reader extends
   point the input languages are statically typed.  The reader extends
   the statically typed language with an \code{Any} type that serves
   the statically typed language with an \code{Any} type that serves
   as a target for compiling the dynamically typed language.
   as a target for compiling the dynamically typed language.
-{\if\edition\pythonEd
-\item Chapter~\ref{ch:Lobject} adds support for \emph{objects} and
-  \emph{classes}.
-\fi}
+%% {\if\edition\pythonEd
+%% \item Chapter~\ref{ch:Lobject} adds support for \emph{objects} and
+%%   \emph{classes}.
+%% \fi}
 \item Chapter~\ref{ch:Lgrad} uses the \code{Any} type introduced in
 \item Chapter~\ref{ch:Lgrad} uses the \code{Any} type introduced in
   Chapter~\ref{ch:Ldyn} to implement a \emph{gradually typed language}
   Chapter~\ref{ch:Ldyn} to implement a \emph{gradually typed language}
   in which different regions of a program may be static or dynamically
   in which different regions of a program may be static or dynamically
@@ -688,7 +688,7 @@ single structure.
 {\if\edition\pythonEd
 {\if\edition\pythonEd
 We use a Python \code{class} for each kind of node.
 We use a Python \code{class} for each kind of node.
 The following is the class definition for
 The following is the class definition for
-constants.
+constants from the Python \code{ast} module.
 \begin{lstlisting}
 \begin{lstlisting}
 class Constant:
 class Constant:
     def __init__(self, value):
     def __init__(self, value):
@@ -1181,7 +1181,8 @@ print(leaf(Constant(8)))
 
 
 
 
 
 
-    
+
+   
    True
    True
    False
    False
    True
    True
@@ -1981,19 +1982,21 @@ The problem with this naive approach is that it does not handle
 situations in which an \LangVar{} feature, such as a variable, is
 situations in which an \LangVar{} feature, such as a variable, is
 nested inside an \LangInt{} feature, such as the \code{-} operator, as
 nested inside an \LangInt{} feature, such as the \code{-} operator, as
 in the following program.
 in the following program.
-%
+
 {\if\edition\racketEd
 {\if\edition\racketEd
 \begin{lstlisting}
 \begin{lstlisting}
 (Let 'y (Int 10) (Prim '- (list (Var 'y))))
 (Let 'y (Int 10) (Prim '- (list (Var 'y))))
 \end{lstlisting}
 \end{lstlisting}
 \fi}
 \fi}
 {\if\edition\pythonEd
 {\if\edition\pythonEd
-  \begin{lstlisting}
+\begin{minipage}{0.96\textwidth}
+\begin{lstlisting}
 y = 10 
 y = 10 
 print(-y)
 print(-y)
 \end{lstlisting}
 \end{lstlisting}
+\end{minipage}
 \fi}
 \fi}
-%
+
 \noindent If we invoke \code{interp\_Lvar} on this program, it
 \noindent If we invoke \code{interp\_Lvar} on this program, it
 dispatches to \code{interp\_Lint} to handle the \code{-} operator, but
 dispatches to \code{interp\_Lint} to handle the \code{-} operator, but
 then it recursively calls \code{interp\_Lint} again on its argument.
 then it recursively calls \code{interp\_Lint} again on its argument.