views:

712

answers:

9

I've been out of school for about 2 years and didn't take a compilers course as an undergrad. At this point, it's something I'm interested in and am wondering if it would be reasonable for me to get a copy of the dragon book and self study? what other resources might you recommend to guide me?

I find that I learn best by doing, so I guess what I'm looking for a book that will walk me through the steps of writing a compiler, with excercises building up to writing a compiler, etc. is this the Dragon book? or should I get that as well as somethign else that will guide me through the exercises?

+4  A: 

The dragon book is absolutely a good resource for self study. The most crucial aspect of it, though, as with any self study, is that you have to actively practice it. Reading it, while interesting, isn't enough to learn the material.

Greg D
+1  A: 

The Dragon book is a pretty good book for self-study. I'd also recommend Programming Language Pragmatics. That's the book we used at my university, and it led me to pick up the Dragon book.

Bill the Lizard
+3  A: 

If you haven't already read Structure and Interpretation of Computer Programs, it's a great self-study book. I read it at about the same stage as you -- a few years out of college and still looking for substantive study.

Chapter 3 changed my approach to programming forever. It's not a compiler text, but it does include a lot of information and thought-provoking commentary on the subject.

Chapter 4 is about interpretation and Chapter 5 is about compilation. I haven't had the time to really work through them as well as I should.

Steven Huwig
+1  A: 

In addition to the dragon book you may also want to pick up a book on lex and yacc. The best way to learn about compilers may be to try and write one. In college, one of our assignments was to write a Pascal compiler. We started simple and added complexity as we became more familiar with the material and the tools. Good luck!

drsnyder
+1  A: 

Yes and no.

Yes - Doing the examples will be very useful and educational.

No - Mastering the details of LR1 parsing is of limited usefulness.

Mike Dunlavey
+4  A: 

At least you got the chance to take a Compiler class with your degree...

Back to the question, YES! An absolute, resounding YES! This is what I am currently doing and I find that it is a rewarding experience for my overall ability, rather than my ability to write and understand compilers.

Whilst I would recommend it I must say that it is pretty heavy reading and you'll need some time to read and understand everything in the book. Also, many people believe the Dragon book to be outdated with some of its examples so I would also recommend Engineering a Compiler by Keith Cooper and Linda Torczon as a more modern alternative for reading alongside or after.

EnderMB
A good deal of the Dragon books material on optimization is more than a little on the dated side.
Kevin Loney
Admittedly true. HOWEVER, the material is straightforward. Not optimal but at least you can get there from a standing start.
Bob Cross
@Kevin It's definitely dated, but dated information is better the no information at all. Hell, most of what I was taught about software development at university is somewhat dated and irrelevant in the real world.
EnderMB
A: 

as a follow up, I have begun to write a compiler using the Dragon book, a book on lex and yacc and lets build a compiler mentioned in this question. The 2 books I picked up used on amazon for something like 15 bucks total with shipping included.

http://stackoverflow.com/questions/1669/learning-to-write-a-compiler

shsteimer
+4  A: 

I've read a couple of times that people preferred Modern Compiler Implementation in {ML,C,Java}, because it's more modern and focuses less on parsing.

http://www.cs.princeton.edu/~appel/modern/

Jules
A: 

I recommend self study. I'm doing it myself.

Btw, latest printing doesn't have the dragon in the cover anymore. :(

abababa22