Andrew Tolmach 3 years ago
parent
commit
a5aab1f93b
1 changed files with 8 additions and 5 deletions
  1. 8 5
      book.tex

+ 8 - 5
book.tex

@@ -13342,15 +13342,17 @@ kind of sequence.
 
 
 \begin{ocamlx}
 \begin{ocamlx}
   For this challenge, you will implement \LangArray{}, a variant of \LangFun{}
   For this challenge, you will implement \LangArray{}, a variant of \LangFun{}
-  supporting arrays. Unlike previous chapters, all that will provided to you
-  are the concrete input grammar for \LangArray{} and
+  supporting arrays. Unlike previous chapters, all that will be provided to you
+  are a specification of the concrete input grammar for \LangArray{} and
   an improved version of \code{runtime.c} that supports garbage collection of
   an improved version of \code{runtime.c} that supports garbage collection of
   arrays (according to a particular specified memory layout convention).
   arrays (according to a particular specified memory layout convention).
   It is up to you to produce appropriately modified versions of \code{RFun.ml}, \code{CFun.ml},
   It is up to you to produce appropriately modified versions of \code{RFun.ml}, \code{CFun.ml},
   and \code{X86Fun.ml}, as well as the passes that glue them together, which you should
   and \code{X86Fun.ml}, as well as the passes that glue them together, which you should
-  put in a file \code{Chapter9Arrays.ml}. You have complete freedom to add
+  put in a file \code{Chapter9Arrays.ml}. You must implement a type checker for
+  source \LangArray{} programs. Otherwise, you
+  hou have complete freedom to add
   features as needed to the intermediate languages and the set of X86 instructions
   features as needed to the intermediate languages and the set of X86 instructions
-  you use.
+  you use. 
 \end{ocamlx} 
 \end{ocamlx} 
 
 
 The Racket language does not distinguish between tuples and arrays,
 The Racket language does not distinguish between tuples and arrays,
@@ -13377,7 +13379,8 @@ inner-product of two arrays (Figure~\ref{fig:inner-product}).
 \begin{itemize}
 \begin{itemize}
   \item An array is created with \code{(array $e_1$ $e_2$)} where $e_1$ evaluates
   \item An array is created with \code{(array $e_1$ $e_2$)} where $e_1$ evaluates
     to an integer representing the length of the array, and $e_2$ evaluates to the
     to an integer representing the length of the array, and $e_2$ evaluates to the
-    initial value to be used for each array element.  
+    initial value to be used for all the array elements. (Note that $e_2$ is evaluated
+    just once per array creation, not once per element!)
   \item The length of an array is returned by \code{(len $e$)} where $e$ evaluates to an array.
   \item The length of an array is returned by \code{(len $e$)} where $e$ evaluates to an array.
   \item Reading from the array is denoted by \code{(@ $e_1$ $e_2$)} where $e_1$ evaluates to an
   \item Reading from the array is denoted by \code{(@ $e_1$ $e_2$)} where $e_1$ evaluates to an
     array and $e_2$ evaluates to an integer index into the array (counting from 0).
     array and $e_2$ evaluates to an integer index into the array (counting from 0).