Maybe it's just my school though.
Maybe it's just my school though.
I can only imagine what he told the kids who wanted to become civil engineers.
*edit: I say that firmly tongue in cheek. The Dragon book is one of the most important pieces of CS literature ever written. It's a fine book, the subject matter is just difficult:)
I half-wish that there would be a way to teach a compilers class as the second class in a CS track (ie, right after the intro class), but the problem is that it just requires too much familiarity with the details in order to impose upon most beginner/intermediate students, even if a few really interested ones could potentially handle it.
It might be easier if you started off with Scheme and then went from there (a la SICP), but even then, you'd miss a lot of the more fundamental concepts assumed in the Dragon book that really just need a lot of time to be digested.
[1] Alright, there's probably a three-way tie for 1st, but it still counts. My education would not have been complete without it; I highly recommend the Dragon book to anybody who has the time and interest.
(I won't give away the punchline for the class. I don't know how far along you are on the project.)
I don't know if "compilers are a solved problem", but I'm pretty damned sure that the only people who need to know that much about text parsing know who they are, and would be able to reference it when needed. As an undergraduate course, it was utterly worthless.
I don't think there's anything wrong with having Discrete Math, Data Structures or Computer Science Theory as pre-requisites for PLT or a compiler class. However, I doubt the necessity of OO Programming & Design and (so-called) Advanced Programming.
It would be great if there was a book on modern compiler techniques, including SSA, abstract interpretation, compiling high level languages, pointer analysis, compiling dynamic dispatch, garbage collection and closures, etc. Probably the closest are Appel's compiler books.
http://store.elsevier.com/product.jsp?isbn=9780120884780
Two of the most important books I own.
Also, thank you for tearing down the dragon book -- I was going to do the same myself.
The dragon book is outdated on parsing, too. It's from a time where single-pass parsing and compilation was sometimes necessary because you didn't have enough memory (or time) to do multiple passes. It certainly doesn't have anything on packrat parsing. It is a historical book -- I would recommend it for no serious purpose (even pedagogical) these days.
I don't trust this book; it has an error that I reported to the authors twice but never heard a word back (or any note of the error in their list of errata).
Here's what I wrote to them:
Subject: Errata for "Engineering a Compiler"
Date: Sat, May 26, 2007 at 8:12 PM
Hello,
I noticed that your section on DFA minimization is labeled
"Hopcroft's Algorithm," but doesn't seem to describe the
algorithm explained by Hopcroft in his 1971 paper [0]. Your
algorithm appears to be n^2, where Hopcroft's is n log n. David
Gries gave a somewhat more digestible presentation of the same
algorithm in a follow-up paper in 1972 [1].
Hope this information is useful!
Sincerely, <me>
[0] John E. Hopcroft. An n log n algorithm for minimizing states
in a finite automaton. Technical Report: CS-TR-71-190, 1971.
Available online at
ftp://reports.stanford.edu/pub/cstr/reports/cs/tr/71/190/CS-TR-71-190.pdf
[1] David Gries. Describing an algorithm by Hopcroft. Acta
Informatica, 2(2):97-109. Online reference:
http://www.springerlink.com/content/r5631549671g6251/
> The dragon book is outdated on parsing, too. It's from a time where single-pass parsing and compilation was sometimes necessary because you didn't have enough memory (or time) to do multiple passes. It certainly doesn't have anything on packrat parsing.I'm pretty sure that all production compilers do one-pass parsing even now because of efficiency concerns. I would be very surprised if any production compiler used packrat parsing which takes O(n) memory.
This was at least 6 years ago though, so my memories are a little cloudy.
In the article, he mentions that the students don't get to compilers till 4th year. I find that a little strange. Some elementary understanding of how a high-level programming language translates to executable code is quite useful in other courses in a standard CS curriculum. At my school, in 2nd year we write a compiler for a tiny subset of C++ to MIPS assembly, and in 4th year you write a compiler for Java with a great deal of optimization.
When I attended my CS course, in the 3rd years I got some understanding about programming language structure and learned about compilers at the end. It's cool that you can learn about that earlier.
@dovyski: it's nice to see this coming from a brazilian university -- I'm from UFABC, São Paulo
Thanks and nice to see a brazilian fellow around here :)
Compilers seems like a pretty standard CS course at most schools.
On the third year at my university, there's a course centered around writing a Java compiler.