The dragon book

Tome of arcane evil

I have had an ongoing fascination with compiler construction for many years now. Unfortunately I’ve never had a single minute of university teaching on the subject, which has been the cause of much confusion about a certain book. If you’re at all familiar with the concept of compiler construction the dragon book should be familiar to you. If not, it’s picture here it is in all it’s glory. Apparently this book says everything you need to know about compiler construction. It’s a true classic.

If you can understand it.

I have huge problems reading this book. It feels like reading an arcane writing in a different language. I have no problems reading complicated stuff but it’s the notation that gets to me. The extremely terse writing, the greek symbols, the little arrows and stuff. It’s hard for me to wrap my head around.

I originally had this post written out as a huge whiny thing about mathematicians generally being silly people sitting in their ivory towers, taunting programmers. I scrapped that. Instead I actually started reading the thing properly. And I had a breakthrough. For anyone wanting to read this book, here’s my guide how to make it through.

You must read every paragraph

This isn’t a book you can coast though the concepts. You pretty much need to read every damn paragraph and if you’re anything like me you’ll need to implement what is says in code. Really. It isn’t optional.

You can’t skip stuff

This is the key point. All my efforts were always to write a parser, so I decided I didn’t need to learn about lexer construction. So I also skipped the section on regular expressions. This didn’t fly. You pretty much have to understand regular expressions in order to write a lexer, and you have to understand a lexer to make a parser.

Once I did this, I understood the classical nature of this book. It never repeats itself, it is full of important information. It’s never bullshitting you. It’s one tough mistress. Mind you, I’m still working my way through chapter four, but I’m thinking this trend is going to hold up.

The thing about compiler construction is that it is one of the most rewarding things in classical computer science that is immensely rewarding to learn. If you do this, you’ll get so much understanding of how computers and language of your choice actually works. I have decided to share a few things that I’ve managed to coax out of this book in upcoming blog posts, which hopefully will culminate in the release of a parser generator that I’ve been working on. If you can’t wait, the parser generator already works, and it’s on github here. It’ll get a proper introduction when it’s done.

Anyway, I hope you’ll be in for the ride. First up will be regular expressions, just like in the dragon book.

Edit: First part is up!

Advertisements
Tagged , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: