Jeremy Siek 2 жил өмнө
parent
commit
72854e9ede
1 өөрчлөгдсөн 13 нэмэгдсэн , 10 устгасан
  1. 13 10
      book.tex

+ 13 - 10
book.tex

@@ -26,7 +26,7 @@
 
 \def\racketEd{0}
 \def\pythonEd{1}
-\def\edition{0}
+\def\edition{1}
 
 % material that is specific to the Racket edition of the book
 \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
   the statically typed language with an \code{Any} type that serves
   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
   Chapter~\ref{ch:Ldyn} to implement a \emph{gradually typed language}
   in which different regions of a program may be static or dynamically
@@ -688,7 +688,7 @@ single structure.
 {\if\edition\pythonEd
 We use a Python \code{class} for each kind of node.
 The following is the class definition for
-constants.
+constants from the Python \code{ast} module.
 \begin{lstlisting}
 class Constant:
     def __init__(self, value):
@@ -1181,7 +1181,8 @@ print(leaf(Constant(8)))
 
 
 
-    
+
+   
    True
    False
    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
 nested inside an \LangInt{} feature, such as the \code{-} operator, as
 in the following program.
-%
+
 {\if\edition\racketEd
 \begin{lstlisting}
 (Let 'y (Int 10) (Prim '- (list (Var 'y))))
 \end{lstlisting}
 \fi}
 {\if\edition\pythonEd
-  \begin{lstlisting}
+\begin{minipage}{0.96\textwidth}
+\begin{lstlisting}
 y = 10 
 print(-y)
 \end{lstlisting}
+\end{minipage}
 \fi}
-%
+
 \noindent If we invoke \code{interp\_Lvar} on this program, it
 dispatches to \code{interp\_Lint} to handle the \code{-} operator, but
 then it recursively calls \code{interp\_Lint} again on its argument.