Browse Source

added paragraph about program and read-program

Jeremy Siek 9 years ago
parent
commit
cdbb075a6d
1 changed files with 21 additions and 9 deletions
  1. 21 9
      book.tex

+ 21 - 9
book.tex

@@ -184,15 +184,15 @@ fun, such as in relating register allocation to Sudoku
 
 \section*{Prerequisites}
 
-This material in this book is challenging but rewarding. It is meant
-to prepare students for a lifelong career in programming languages.  I
-do not recommend this book for students who only want to dabble in
-programming languages.  The book uses the Racket language both for the
-implementation of the compiler and for the language that is
-compiled. Thus, a student should be proficient with Racket (or Scheme)
-prior to reading this book. There are many other excellent resources
-for learning Racket and
-Scheme~\citep{Dybvig:1987aa,Abelson:1996uq,Friedman:1996aa,Felleisen:2001aa,Felleisen:2013aa,Flatt:2014aa}. It
+The material in this book is challenging but rewarding. It is meant to
+prepare students for a lifelong career in programming languages.  I do
+not recommend this book for students who want to dabble in programming
+languages.  Because the book uses the Racket language both for the
+implementation of the compiler and for the language that is compiled,
+a student should be proficient with Racket (or Scheme) prior to
+reading this book. There are many other excellent resources for
+learning Scheme and
+Racket~\citep{Dybvig:1987aa,Abelson:1996uq,Friedman:1996aa,Felleisen:2001aa,Felleisen:2013aa,Flatt:2014aa}. It
 is helpful but not necessary for the student to have prior exposure to
 x86 (or x86-64) assembly language~\citep{Intel:2015aa}, as one might
 obtain from a computer systems
@@ -375,6 +375,14 @@ to mark the top of the whole program:
   R_0 ::= (\key{program} \; \Exp)
 \]
 
+The \code{read-program} function provided in \code{utilities.rkt}
+reads programs in from a file (the sequence of characters in the
+concrete syntax of Racket) and parses them into the abstract syntax
+tree. The concrete syntax does not include a \key{program} form; that
+is added by the \code{read-program} function as it creates the
+AST. See the description of \code{read-program} in
+Appendix~\ref{appendix:utilities} for more details.
+
 It is common to have many rules with the same left-hand side, such as
 $\Exp$ in the grammar for $R_0$, so there is a vertical bar notation
 for gathering several rules, as shown in
@@ -3540,6 +3548,10 @@ for an x86-64 program.
 The utility function described in this section can be found in the
 \key{utilities.rkt} file.
 
+The \key{read-program} function takes a file path and parses that file
+(it must be a Racket proram) into an abstract syntax tree (as an
+S-expression) with a \key{program} AST at the top.
+
 The \key{assert} function displays the error message \key{msg} if the
 Boolean \key{bool} is false.
 \begin{lstlisting}