

Rich Programmer Food - iamelgringo
http://steve-yegge.blogspot.com/2007/06/rich-programmer-food.html?

======
jey
I don't know what to think of this post. I've definitely learned a whole hell
of a lot from my compiler projects, but I don't see the point of turning
compilers into a religion. I wouldn't go around telling people that they have
to learn compilers to be a "real programmer", but it does seem like a pretty
comprehensive litmus test: if you've written a compiler from scratch, it
proves you really do understand something about algorithms, data structures,
and systems software.

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.

~~~
Leon
It's just that writing a compiler requires such a large up front amount of
knowledge of how computers work, and teaches you so much more, that it's hard
to compare to any other project where you can learn exactly what is happening
in a computer and what every line of your code actually does to the operation
of the machine you are working on/targeting.

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.

------
kirubakaran
After reading this post when it came out, I started learning about compilers.
I bought the dragon book from AbeBooks.com (which cost just $3.50 there;
Amazon = $85) and I am reading it now.

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?

~~~
jey
Engineering a Compiler by Cooper and Torczon is probably better these days
than the dragon book. The dragon book is of primarily historical interest imo.
(Unless you really do need to write an LL( _k_ ) parser generator...)

I would say coding is more important than studying the books a lot.

~~~
mhartl
A new 2nd edition of the Dragon Book just came out last summer. Is that one
still only of historical interest?

~~~
jey
I don't know, I haven't looked at it. But you won't go wrong with Cooper &
Torczon.

------
kcl
This is a very long article, and it's founded on a false premise.

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.

~~~
abstractbill
_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._

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.

~~~
kcl
Eval in Lisp is half a page. That's not a lot of material. If you further
discount machine language, the only thing left for a compiler/interpreter to
do is handle eccentricities in language syntax. This is rote and arbitrary
application of data structures. Rarely do I find it edifying to "undo"
complexity that someone else has added, at whim, to computation.

~~~
jonnytran
Although Steve Yegge brings up a lot of interesting points, he's bad at
explaining them.

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.

~~~
yters
And a tangent on that:

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...

------
brlewis
He admits that situations 1-4 are pretty much solved once you have a parse
tree. I think situations 5 and 7 are too. My perspective is that the
compiler's work is only just getting started once you have a parse tree. I was
hoping for a hint as to what about compilers was so important; if it's just
parsing then no news here.

------
tlrobinson
Compilers is one of the few classes I really regret not taking in college.
Fortunately, I discovered the unprotected URL to my university's online
lectures site (no you can't have it) and might just have to watch this
semester's class...

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...](http://www.amazon.com/Advanced-Compiler-Design-
Implementation-Muchnick/dp/1558603204)

------
codewhisperer
I've skimmed, not read, the article, but it's good enough that I'll be causing
some tree-death to read it slowly on the train home tonight. I might have to
rebalance my algorithms v. compilers heuristic.

------
Tichy
Hasn't all that become obsolete with XML and XSLT? (Kidding...)

------
albertcardona
What do you think life is, but a compiler that translates abstract code
(genomes) into machine code (living cells)?

Generalizing from what the author says, any information can be streamed into a
compiler and then ... the world moves.

