Jeremy Siek há 3 anos atrás
pai
commit
d9ca107833
2 ficheiros alterados com 18 adições e 12 exclusões
  1. 17 12
      book.tex
  2. 1 0
      defs.tex

+ 17 - 12
book.tex

@@ -10062,12 +10062,12 @@ variable shadowing and our logic for \code{let} can remain simple, as
 in the exerpt above.
 
 The second step is to mark the occurences of the mutable variables
-with the new \code{GetBang} AST node. The following is an exerpt of
-the \code{uncover-get!-exp} function, which takes two parameters: the
-set of mutable varaibles \code{set!-vars}, and the expression \code{e}
-to be processed. The case for \code{(Var x)} replaces it with
-\code{(GetBang x)} if it is a mutable variable or leaves it alone if
-not.
+with the new \code{GetBang} AST node (\code{get!} in concrete
+syntax). The following is an exerpt of the \code{uncover-get!-exp}
+function, which takes two parameters: the set of mutable varaibles
+\code{set!-vars}, and the expression \code{e} to be processed. The
+case for \code{(Var x)} replaces it with \code{(GetBang x)} if it is a
+mutable variable or leaves it alone if not.
 \begin{center}
 \begin{minipage}{\textwidth}
 \begin{lstlisting}
@@ -10095,9 +10095,9 @@ their occurences with \code{GetBang}.
 
 {\if\edition\racketEd
 %
-The three new language forms, \code{while}, \code{set!}, and
-\code{begin} are all complex expressions and their subexpressions are
-allowed to be complex.
+The new language forms, \code{get!}, \code{set!}, \code{begin}, and
+\code{while} are all complex expressions. The subexpressions of
+\code{set!}, \code{begin}, and \code{while} are allowed to be complex.
 %
 \fi}
 {\if\edition\pythonEd
@@ -10123,8 +10123,10 @@ Figure~\ref{fig:Rwhile-anf-syntax} defines the output language
 \Atm &::=& \gray{ \INT{\Int} \MID \VAR{\Var} \MID \BOOL{\itm{bool}}
        \MID \VOID{} } \\
 \Exp &::=& \ldots \MID \gray{ \LET{\Var}{\Exp}{\Exp} } \\
-    &\MID& \WHILE{\Exp}{\Exp} \MID \SETBANG{\Var}{\Exp}
-   \MID \BEGIN{\LP\Exp\ldots\RP}{\Exp} \\
+     &\MID& \GETBANG{\Var}
+      \MID \SETBANG{\Var}{\Exp} \\
+     &\MID& \BEGIN{\LP\Exp\ldots\RP}{\Exp}
+      \MID \WHILE{\Exp}{\Exp} \\
 \Def &::=& \gray{ \FUNDEF{\Var}{([\Var \code{:} \Type]\ldots)}{\Type}{\code{'()}}{\Exp} }\\
 \LangLoopANF  &::=& \gray{ \PROGRAMDEFS{\code{'()}}{\Def} }
 \end{array}
@@ -10163,7 +10165,8 @@ expressions have been bound to temporary variables. Recall that
 \code{let} expressions in \LangLoopANF{} are allowed to have
 arbitrary expressions in their right-hand-side expression, so it is
 fine to place \code{begin} there.
-
+\begin{center}
+\begin{minipage}{\textwidth}
 \begin{lstlisting}
 (let ([x0 10])
   (let ([y1 0])
@@ -10178,6 +10181,8 @@ fine to place \code{begin} there.
         (let ([tmp4 (+ tmp2 tmp3)])
           (+ tmp4 x0))))))
 \end{lstlisting}
+\end{minipage}
+\end{center}
 
 \fi}
 

+ 1 - 0
defs.tex

@@ -200,6 +200,7 @@
 \newcommand{\BEGIN}[2]{\LP\key{Begin}~#1~#2\RP}
 \newcommand{\CSETBANG}[2]{\LP\key{set!}~#1~#2\RP}
 \newcommand{\SETBANG}[2]{\LP\key{SetBang}~#1~#2\RP}
+\newcommand{\GETBANG}[1]{\LP\key{GetBang}~#1\RP}
 \newcommand{\NOT}[1]{\key{(Prim}~\code{not}~\code{(}#1~\code{))}}
 \newcommand{\CAST}[3]{\LP\key{Cast}~#1~#2~#3\RP}
 \newcommand{\VECTOR}[1]{\LP\key{Prim}~\code{vector}~\LP~#1\RP\RP}