Jeremy Siek пре 9 година
родитељ
комит
5f5177e239
2 измењених фајлова са 135 додато и 44 уклоњено
  1. 70 1
      all.bib
  2. 65 43
      book.tex

+ 70 - 1
all.bib

@@ -2,13 +2,82 @@
 %% http://bibdesk.sourceforge.net/
 
 
-%% Created for Jeremy Siek at 2016-01-04 16:32:32 -0500 
+%% Created for Jeremy Siek at 2016-01-05 12:54:43 -0500 
 
 
 %% Saved with string encoding Unicode (UTF-8) 
 
 
 
+@book{Bryant:2010aa,
+	Address = {USA},
+	Author = {Bryant, Randal E. and O'Hallaron, David R.},
+	Date-Added = {2016-01-05 17:52:13 +0000},
+	Date-Modified = {2016-01-05 17:52:17 +0000},
+	Edition = {2nd},
+	Isbn = {0136108040, 9780136108047},
+	Publisher = {Addison-Wesley Publishing Company},
+	Title = {Computer Systems: A Programmer's Perspective},
+	Year = {2010}}
+
+@book{Dybvig:1987aa,
+	Address = {Upper Saddle River, NJ, USA},
+	Author = {Dybvig, R. Kent},
+	Date-Added = {2016-01-05 17:42:43 +0000},
+	Date-Modified = {2016-01-05 17:42:46 +0000},
+	Isbn = {0-13-791864-X},
+	Publisher = {Prentice-Hall, Inc.},
+	Title = {The SCHEME Programming Language},
+	Year = {1987}}
+
+@book{Felleisen:2013aa,
+	Address = {San Francisco, CA, USA},
+	Author = {Felleisen, Matthias and Conrad, M.D. Barski and Horn, David Van and Eight Students of Northeastern University},
+	Date-Added = {2016-01-05 17:40:45 +0000},
+	Date-Modified = {2016-01-05 17:40:48 +0000},
+	Isbn = {1593274912, 9781593274917},
+	Publisher = {No Starch Press},
+	Title = {Realm of Racket: Learn to Program, One Game at a Time!},
+	Year = {2013}}
+
+@book{Felleisen:2001aa,
+	Address = {Cambridge, MA, USA},
+	Author = {Felleisen, Matthias and Findler, Robert Bruce and Flatt, Matthew and Krishnamurthi, Shriram},
+	Date-Added = {2016-01-05 17:38:45 +0000},
+	Date-Modified = {2016-01-05 17:38:49 +0000},
+	Isbn = {0-262-06218-6},
+	Publisher = {MIT Press},
+	Title = {How to Design Programs: An Introduction to Programming and Computing},
+	Year = {2001}}
+
+@techreport{Dybvig:2010aa,
+	Author = {R. Kent Dybvig and Andrew Keep},
+	Date-Added = {2016-01-05 17:02:52 +0000},
+	Date-Modified = {2016-01-05 17:05:12 +0000},
+	Institution = {Indiana University},
+	Title = {P523 Compiler Assignments},
+	Year = {2010},
+	Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUGJCVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKgHCBMUFRYaIVUkbnVsbNMJCgsMDxJXTlMua2V5c1pOUy5vYmplY3RzViRjbGFzc6INDoACgAOiEBGABIAFgAdccmVsYXRpdmVQYXRoWWFsaWFzRGF0YV8QFHA1MjMtYXNzaWdubWVudHMucGRm0hcLGBlXTlMuZGF0YU8RAYIAAAAAAYIAAgAADE1hY2ludG9zaCBIRAAAAAAAAAAAAAAAAAAAAM3IwOpIKwAAAL9t8RRwNTIzLWFzc2lnbm1lbnRzLnBkZgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABL7Qp0rFh3FBERiBDQVJPAAEAAgAACSAAAAAAAAAAAAAAAAAAAAADYmliAAAQAAgAAM3I+SoAAAARAAgAANKxqCwAAAABAAwAv23xAAXAcgACEikAAgA0TWFjaW50b3NoIEhEOlVzZXJzOgBqc2llazoAYmliOgBwNTIzLWFzc2lnbm1lbnRzLnBkZgAOACoAFABwADUAMgAzAC0AYQBzAHMAaQBnAG4AbQBlAG4AdABzAC4AcABkAGYADwAaAAwATQBhAGMAaQBuAHQAbwBzAGgAIABIAEQAEgAkVXNlcnMvanNpZWsvYmliL3A1MjMtYXNzaWdubWVudHMucGRmABMAAS8AABUAAgAM//8AAIAG0hscHR5aJGNsYXNzbmFtZVgkY2xhc3Nlc11OU011dGFibGVEYXRhox0fIFZOU0RhdGFYTlNPYmplY3TSGxwiI1xOU0RpY3Rpb25hcnmiIiBfEA9OU0tleWVkQXJjaGl2ZXLRJidUcm9vdIABAAgAEQAaACMALQAyADcAQABGAE0AVQBgAGcAagBsAG4AcQBzAHUAdwCEAI4ApQCqALICOAI6Aj8CSgJTAmECZQJsAnUCegKHAooCnAKfAqQAAAAAAAACAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAACpg==}}
+
+@incollection{Mairson:1991aa,
+	Author = {Mairson, HarryG.},
+	Booktitle = {Functional Programming Languages and Computer Architecture},
+	Date-Added = {2016-01-05 14:24:12 +0000},
+	Date-Modified = {2016-01-05 14:24:14 +0000},
+	Doi = {10.1007/3540543961_15},
+	Editor = {Hughes, John},
+	Isbn = {978-3-540-54396-1},
+	Language = {English},
+	Pages = {313-327},
+	Publisher = {Springer Berlin Heidelberg},
+	Series = {Lecture Notes in Computer Science},
+	Title = {Outline of a proof theory of parametricity},
+	Url = {http://dx.doi.org/10.1007/3540543961_15},
+	Volume = {523},
+	Year = {1991},
+	Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUGJCVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKgHCBMUFRYaIVUkbnVsbNMJCgsMDxJXTlMua2V5c1pOUy5vYmplY3RzViRjbGFzc6INDoACgAOiEBGABIAFgAdccmVsYXRpdmVQYXRoWWFsaWFzRGF0YV8QHnByb29mLXRoZW9yeS1wYXJhbWV0cmljaXR5LnBkZtIXCxgZV05TLmRhdGFPEQGqAAAAAAGqAAIAAAxNYWNpbnRvc2ggSEQAAAAAAAAAAAAAAAAAAADNyMDqSCsAAAC/bfEecHJvb2YtdGhlb3J5LXBhcmFtZXRyaWNpdHkucGRmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAS+aktKxPCFQREYgAAAAAAABAAIAAAkgAAAAAAAAAAAAAAAAAAAAA2JpYgAAEAAIAADNyPkqAAAAEQAIAADSsYJxAAAAAQAMAL9t8QAFwHIAAhIpAAIAPk1hY2ludG9zaCBIRDpVc2VyczoAanNpZWs6AGJpYjoAcHJvb2YtdGhlb3J5LXBhcmFtZXRyaWNpdHkucGRmAA4APgAeAHAAcgBvAG8AZgAtAHQAaABlAG8AcgB5AC0AcABhAHIAYQBtAGUAdAByAGkAYwBpAHQAeQAuAHAAZABmAA8AGgAMAE0AYQBjAGkAbgB0AG8AcwBoACAASABEABIALlVzZXJzL2pzaWVrL2JpYi9wcm9vZi10aGVvcnktcGFyYW1ldHJpY2l0eS5wZGYAEwABLwAAFQACAAz//wAAgAbSGxwdHlokY2xhc3NuYW1lWCRjbGFzc2VzXU5TTXV0YWJsZURhdGGjHR8gVk5TRGF0YVhOU09iamVjdNIbHCIjXE5TRGljdGlvbmFyeaIiIF8QD05TS2V5ZWRBcmNoaXZlctEmJ1Ryb290gAEACAARABoAIwAtADIANwBAAEYATQBVAGAAZwBqAGwAbgBxAHMAdQB3AIQAjgCvALQAvAJqAmwCcQJ8AoUCkwKXAp4CpwKsArkCvALOAtEC1gAAAAAAAAIBAAAAAAAAACgAAAAAAAAAAAAAAAAAAALY},
+	Bdsk-Url-1 = {http://dx.doi.org/10.1007/3540543961_15}}
+
 @techreport{Siek:2012ab,
 	Author = {Jeremy G. Siek and Bor-Yuh Evan Chang},
 	Date-Added = {2016-01-04 21:31:42 +0000},

+ 65 - 43
book.tex

@@ -107,72 +107,94 @@ University.
 
 The tradition of compiler writing at Indiana University goes back to
 programming language research and courses taught by Daniel Friedman in
-the 1970'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 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 early 2000's, Kent continued
-development of Chez Scheme and rotated with Dan in teaching the
-compiler course.
+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
+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 early 2000's, Kent continued development of
+Chez Scheme and rotated with Dan in teaching the compiler course.
 
 Thanks to this collaboration between Dan and Kent, the compiler course
 evolved to incorporate novel pedagogical ideas while also including
-elements of effective real-world compilers.  One of the pedagogical
-ideas was to split the compiler into many small passes over the input
-program and subsequent intermediate representations, so that the code
-for each pass is easy to understood in isolation.  (In contrast, most
-compilers of the time were organized into only a few large passes for
-reasons of compile-time efficiency.)  Kent and 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}. I took this compiler
-course in the early 2000's, as part of my Ph.D. studies at Indiana
-University.
+elements of effective real-world compilers.  One of Dan's ideas was to
+split the compiler into many small passes over the input program and
+subsequent intermediate representations, 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 and 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}. I took this compiler course
+in the early 2000's, as part of my Ph.D. studies at Indiana
+University. Needless to say, I enjoyed the course immensely.
 
 One of my classmates, Abdulaziz Ghuloum, observed that the
 front-to-back organization of the course made it difficult for
 students to understand the rationale for the compiler
 design. Abdulaziz proposed an incremental approach in which the
-students build the compiler in stages, starting by implementing a
+students build the compiler in stages; they start by implementing a
 complete compiler for a very small subset of the input language, then
-gradually adding features to the input language and adding or
-modifying passes to handle those features~\citep{Ghuloum:2006bh}.
+in each subsequent stage they add a feature to the input language and
+add or modify passes to handle the new feature~\citep{Ghuloum:2006bh}.
+In this way, the students see how the language features motivate
+aspects of the compiler design.
 
 After graduating from Indiana University in 2005, I went on to teach
-at the University of Colorado. I adapted the nano-pass and incremental
+at the University of Colorado. I adapted the nano pass and incremental
 approaches to compiling a subset of the Python
 language~\citep{Siek:2012ab}.  Python and Scheme are quite different
 on the surface but there is a large overlap in the compiler techniques
 required for the two languages. Thus, I was able to teach much of the
 same content from the Indiana compiler course. I very much enjoyed
-teaching the course organized according to the nano-pass and
-incremental approaches, and even better, many of the students learned
-a lot and got excited about compilers.  (No, I didn't do a
-quantitative study to support this claim.)
+teaching the course organized in this way, and even better, many of
+the students learned a lot and got excited about compilers.  (No, I
+didn't do a quantitative study to support this claim.)
 
 It is now 2016 and I too have returned to teach at Indiana University.
 In my absence the compiler course had switched from the front-to-back
 organization to a back-to-front organization. Seeing how well the
 incremental approach worked at Colorado, I found this rather
-unsatisfactory and have therefore proceeded to reorganize the course,
-porting and adapting the structure of the Colorado course back into
-the land of Scheme. Of course, in the meantime Scheme has been
-superseded by Racket (at least in Indiana), so the course is now about
-implementing, in Racket~\citep{plt-tr}, a subset of Racket.
+unsatisfactory and have proceeded to reorganize the course, porting
+and adapting the structure of the Colorado course back into the land
+of Scheme. Of course, in the meantime Scheme has been superseded by
+Racket (at least in Indiana), so the course is now about implementing,
+in Racket~\citep{plt-tr}, a subset of Racket.
 
 This is the textbook for the incremental version of the compiler
-course at Indiana Unversity. This book would have been better written
-by Dan, Kent, and Abdulaziz, but it seems that I am the one with the
-time and enthusiasm. With this book I hope to make the Indiana
-compiler course available to people that have not had the chance to
-study here in person.
-
-
-Talk about pre-requisites.
+course at Indiana University (Spring 2016) and it is the first attempt
+to create a textbook for the Indiana compiler course.  With this book
+I hope to make the Indiana compiler course available to people that
+have not had the chance to study here in person.  Many of the compiler
+design decisions in this book are drawn from the assignment
+descriptions of \cite{Dybvig:2010aa}. I have captured what I think are
+the most important topics from \cite{Dybvig:2010aa} but have omitted
+topics that I think are less interesting conceptually and I have made
+simplifications to reduce complexity.  In this way, this book leans
+more towards pedagogy than towards absolute efficiency. Also, the book
+differs in places where I saw the opportunity to make the topics more
+fun, such as in relating register allocation to Sudoku
+(Chapter~\ref{ch:register-allocation}).
+
+\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
+is helpful but not necessary for the student to have prior exposure to
+the x86 (or x86-64) assembly language, as one might get from a
+computer systems course~\citep{Bryant:2005aa,Bryant:2010aa}.  This
+book will introduce the basics of the x86-64 assembly language.
 
 %\section*{Structure of book}
 % You might want to add short description about each chapter in this book.