Rich Programmer Food
steve-yegge.blogspot.com
steve-yegge.blogspot.com
Steve implies "Learn compilers if you want to be a Real Programmer(TM)!", but I'd say: Write a compiler if you want a project that will teach you a lot and will be a lot of fun with interesting challenges along the way.
Sure other projects you can learn just as much general knowledge, but I'm going to agree with Steve that it's pretty enlightening. I'll also agree that it is a bottomless pit of your time and effort.
I found 'Incremental Approach To Compiler Construction' [pdf] (http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf) to be really great.
Anybody else here learning compiler construction? Any suggestions?
I would say coding is more important than studying the books a lot.
Is "Engineering a Compiler by Cooper and Torczon" good for actually coding a compiler?
(This is my philosophy toward learning anything programming related, so maybe I'm just weird.)
The Practice of Programming: http://cm.bell-labs.com/cm/cs/tpop/toc.html
Compilers is not an important topic because there's nothing universal you can take out of it. Machine code as we know it is a pretty arbitrary construction. Register machines themselves are pretty arbitrary---they're just one way to make use of transistor circuitry. The conversion from C to machine code is not really worth remembering. It's true that this system forms the basis for all our computing, but like the nanoscale physics of semiconductors, it's not required knowledge for programmers. It's just a bag of rules...it's not even a bag of tricks.
If you work at Intel optimizing compilers, then maybe you need to know this stuff. If you never hunch down and program inline assembly, why do you care? You're too far from the bytecode to leverage compiler knowledge against performance, and in fact you'd probably be wasting your time to do so. Its workings operate below the required level of abstraction. Understand what's going on, but leave the details to someone else. I don't need to know how Firefox implements an HTML parser to render my webpage. I just need to know that it does so in a consistent way.
Compiler implementations are pretty arbitrary, and oftentimes they're filled with a lot of goofy stuff. We shouldn't still be carrying cruft like Please-Excuse-My-Dear-Aunt-Sally around in our languages---and this is half of what a compiler does. If there's anything beautiful to take out of a compilers class, it's that a compiler can compile itself. There---I've spoiled the ending, skip the course and take a theory class instead.
Compilers have nothing to do with machine code, other than that's sometimes the output target. There are plenty of other (often more interesting) targets.
Learning about compilers and programming languages is important because of the principles inherent in building them, which average programmers never completely get.
In my opinion, these principles are:
1) Code is data, and data can be code.
2) The only sensible way to deal with unmanageably-large amounts of code is by creating a language (whether this be an API, a protocol, a DSL, or a Turing-complete programming language) to communicate with.
3) Many classes of problems can be thought of as a transformation of a data-structure in one language to an "equivalent" data-structure in another language, which at its core, is all a compiler does.
It's been said that algorithm + data structure = program. But really, the only true 'algorithm' is the cpu. Everything else is clever data structures.
Just thought I would say...
I started watching them, and the professor recommends this book (and the new edition of the Dragon Book):
http://www.amazon.com/Advanced-Compiler-Design-Implementatio...
Generalizing from what the author says, any information can be streamed into a compiler and then ... the world moves.