Browse Source

added exercises for chapters 7 and 8

Jeremy Siek 4 years ago
parent
commit
a1c05d116c
1 changed files with 27 additions and 1 deletions
  1. 27 1
      book.tex

+ 27 - 1
book.tex

@@ -6401,7 +6401,7 @@ _mainconclusion:
 \end{figure}
 \end{figure}
 
 
 \begin{exercise}\normalfont
 \begin{exercise}\normalfont
-Expand your compiler to handle $R_4$ as outlined in this section.
+Expand your compiler to handle $R_4$ as outlined in this chapter.
 Create 5 new programs that use functions, including examples that pass
 Create 5 new programs that use functions, including examples that pass
 functions and return functions from other functions and including
 functions and return functions from other functions and including
 recursive functions. Test your compiler on these new programs and all
 recursive functions. Test your compiler on these new programs and all
@@ -6874,6 +6874,12 @@ $\Downarrow$
 Figure~\ref{fig:R5-passes} provides an overview of all the passes needed
 Figure~\ref{fig:R5-passes} provides an overview of all the passes needed
 for the compilation of $R_5$.
 for the compilation of $R_5$.
 
 
+\begin{exercise}\normalfont
+Expand your compiler to handle $R_5$ as outlined in this chapter.
+Create 5 new programs that use \key{lambda} functions and make use of
+lexical scoping. Test your compiler on these new programs and all of
+your previously created test programs.
+\end{exercise}
 
 
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -7405,6 +7411,13 @@ of type \code{Any} in the same way that it treats variables of type
   to the root stack instead of the normal procedure call stack.
   to the root stack instead of the normal procedure call stack.
 \end{itemize}
 \end{itemize}
 
 
+\begin{exercise}\normalfont
+Expand your compiler to handle $R_6$ as discussed in the last few
+sections.  Create 5 new programs that use the \code{Any} type and the
+new operations (\code{inject}, \code{project}, \code{boolean?},
+etc.). Test your compiler on these new programs and all of your
+previously created test programs.
+\end{exercise}
 
 
 \section{Compiling $R_7$ to $R_6$}
 \section{Compiling $R_7$ to $R_6$}
 \label{sec:compile-r7}
 \label{sec:compile-r7}
@@ -7550,6 +7563,19 @@ $\Rightarrow$
 \label{fig:compile-r7-r6}
 \label{fig:compile-r7-r6}
 \end{figure}
 \end{figure}
 
 
+
+\begin{exercise}\normalfont
+Expand your compiler to handle $R_7$ as outlined in this chapter.
+Create tests for $R_7$ by adapting all of your previous test programs
+by removing type annotations. Add 5 more tests programs that
+specifically rely on the language being dynamically typed. That is,
+they should not be legal programs in a statically typed language, but
+nevertheless, they should be valid $R_7$ programs that run to
+completion without error.
+\end{exercise}
+
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Gradual Typing}
 \chapter{Gradual Typing}
 \label{ch:gradual-typing}
 \label{ch:gradual-typing}