瀏覽代碼

More chapter 1 edits

Ryan Newton 7 年之前
父節點
當前提交
758fa891af
共有 1 個文件被更改,包括 24 次插入8 次删除
  1. 24 8
      book.tex

+ 24 - 8
book.tex

@@ -331,17 +331,26 @@ integer is an expression, $\Exp$, in the language:
 \begin{equation}
 \Exp ::= \Int  \label{eq:arith-int}
 \end{equation}
+%
 Each rule has a left-hand-side and a right-hand-side. The way to read
 a rule is that if you have all the program parts on the
 right-hand-side, then you can create an AST node and categorize it
-according to the left-hand-side. (We do not define $\Int$ because the
-reader already knows what an integer is.) We make the simplifying
-design decision that all of the languages in this book only handle
-machine-representable integers (those representable with 64-bits,
-i.e., the range $-2^{63}$ to $2^{63}-1$)
- which is similar to the \texttt{fixnum} datatype in Racket.
+according to the left-hand-side.
+%
 A name such as $\Exp$ that is
 defined by the grammar rules is a \emph{non-terminal}.
+%
+The name $\Int$ is a also a non-terminal, however,
+we do not define $\Int$ because the
+reader already knows what an integer is.
+%
+Further, we make the simplifying design decision that all of the languages in
+this book only handle machine-representable integers.  On most modern machines
+this corresponds to integers represented with 64-bits, i.e., the in range
+$-2^{63}$ to $2^{63}-1$.
+%
+However, we restrict this range further to match the Racket \texttt{fixnum}
+datatype, which allows 63-bit integers on a 64-bit machine.
 
 The second grammar rule is the \texttt{read} operation that receives
 an input integer from the user of the program.
@@ -497,8 +506,15 @@ The \texttt{match} form takes AST \eqref{eq:arith-prog} and binds its
 parts to the three variables \texttt{op}, \texttt{child1}, and
 \texttt{child2}. In general, a match clause consists of a
 \emph{pattern} and a \emph{body}. The pattern is a quoted S-expression
-that may contain pattern-variables (preceded by a comma).  The body
-may contain any Racket code.
+that may contain pattern-variables (preceded by a comma).
+%
+The pattern is not the same thing as a quasiquote expression used to
+\emph{construct} ASTs, however, the similarity is intentional: constructing and
+deconstructing ASTs uses similar syntax.
+%
+While the pattern uses a restricted syntax, 
+the body of the match clause may contain any Racket code whatsoever.
+
 
 A \texttt{match} form may contain several clauses, as in the following
 function \texttt{leaf?} that recognizes when an $R_0$ node is