|
@@ -126,17 +126,19 @@ University.
|
|
|
\chapter*{Preface}
|
|
|
|
|
|
The tradition of compiler writing at Indiana University goes back to
|
|
|
-programming language research and courses taught by Daniel Friedman in
|
|
|
-the 1970's and 1980's. Dan had conducted research on lazy evaluation
|
|
|
-in the context of Lisp~\citep{McCarthy:1960dz} and then studied
|
|
|
-continuations and macros in the context of the
|
|
|
-Scheme~\citep{Sussman:1975ab}, a dialect of Lisp. One of students of
|
|
|
-those courses, Kent Dybvig, went on to build Chez
|
|
|
+research and courses about programming languages by Daniel Friedman in
|
|
|
+the 1970's and 1980's. Dan had conducted research on lazy
|
|
|
+evaluation~\citep{Friedman:1976aa} in the context of
|
|
|
+Lisp~\citep{McCarthy:1960dz} and then studied
|
|
|
+continuations~\citep{Felleisen:kx} and
|
|
|
+macros~\citep{Kohlbecker:1986dk} in the context of the
|
|
|
+Scheme~\citep{Sussman:1975ab}, a dialect of Lisp. One of the students
|
|
|
+of those courses, Kent Dybvig, went on to build Chez
|
|
|
Scheme~\citep{Dybvig:2006aa}, a production-quality and efficient
|
|
|
compiler for Scheme. After completing his Ph.D. at the University of
|
|
|
North Carolina, Kent returned to teach at Indiana University.
|
|
|
-Throughout the 1990's and 2000's, Kent continued development of
|
|
|
-Chez Scheme and taught the compiler course.
|
|
|
+Throughout the 1990's and 2000's, Kent continued development of Chez
|
|
|
+Scheme and taught the compiler course.
|
|
|
|
|
|
The compiler course evolved to incorporate novel pedagogical ideas
|
|
|
while also including elements of effective real-world compilers. One
|
|
@@ -144,7 +146,7 @@ of Dan's ideas was to split the compiler into many small ``passes'' so
|
|
|
that the code for each pass would be easy to understood in isolation.
|
|
|
(In contrast, most compilers of the time were organized into only a
|
|
|
few monolithic passes for reasons of compile-time efficiency.) Kent,
|
|
|
-with help later from his students Dipanwita Sarkar and Andrew Keep,
|
|
|
+with later help from his students Dipanwita Sarkar and Andrew Keep,
|
|
|
developed infrastructure to support this approach and evolved the
|
|
|
course, first to use micro-sized passes and then into even smaller
|
|
|
nano passes~\citep{Sarkar:2004fk,Keep:2012aa}. Jeremy Siek took this
|
|
@@ -191,7 +193,7 @@ not had the chance to study in Bloomington in person. Many of the
|
|
|
compiler design decisions in this book are drawn from the assignment
|
|
|
descriptions of \cite{Dybvig:2010aa}. We have captured what we think are
|
|
|
the most important topics from \cite{Dybvig:2010aa} but we have omitted
|
|
|
-topics that I think are less interesting conceptually and we have made
|
|
|
+topics that we think are less interesting conceptually and we have made
|
|
|
simplifications to reduce complexity. In this way, this book leans
|
|
|
more towards pedagogy than towards the absolute efficiency of the
|
|
|
generated code. Also, the book differs in places where we saw the
|
|
@@ -265,8 +267,8 @@ language used to write the compiler.
|
|
|
%
|
|
|
Because this book uses Racket (\url{http://racket-lang.org}), a
|
|
|
descendant of Lisp, we use S-expressions to represent programs
|
|
|
-(Section~\ref{sec:ast}), grammars to defined programming languages
|
|
|
-(Section~\ref{sec:grammar}), and pattern matching to inspect
|
|
|
+(Section~\ref{sec:ast}). We use grammars to defined programming languages
|
|
|
+(Section~\ref{sec:grammar}) and pattern matching to inspect
|
|
|
individual nodes in an AST (Section~\ref{sec:pattern-matching}). We
|
|
|
use recursion to construct and deconstruct entire ASTs
|
|
|
(Section~\ref{sec:recursion}). This chapter provides an brief
|
|
@@ -6702,7 +6704,11 @@ Boolean \key{bool} is false.
|
|
|
(define (assert msg bool) ...)
|
|
|
\end{lstlisting}
|
|
|
|
|
|
-The \key{lookup} function ...
|
|
|
+The \key{lookup} function takes a key and an association list (a list
|
|
|
+of key-value pairs), and returns the first value that is associated
|
|
|
+with the given key, if there is one. If not, an error is triggered.
|
|
|
+The association list may contain both immutable pairs (built with
|
|
|
+\key{cons}) and mutable mapirs (built with \key{mcons}).
|
|
|
|
|
|
The \key{map2} function ...
|
|
|
|