Hacker News new | past | comments | ask | show | jobs | submit login

This series is one of the best introductions to compiler construction. It doesn't cover everything and it's 25 years old now, but it is the only guide I know of that will hold your hand as you build a working compiler from scratch.

If you have never built a compiler before, I cannot think of a better place to start.

Afterward, if you're curious about theory and advanced topics, I recommend heading to Compilers: Principles, Techniques, and Tools by Aho, Sethi, and Ullman (which covers a lot of theory associated with front-ends) then proceeding to Modern Compiler Construction in ML by Appel (which covers some more advanced topics and back-end stuff). Then you can continue reading about more specific/advanced topics if you like.

There is a class about compilers on coursera [1] which should be pretty good and more up to date.

[1] https://www.coursera.org/course/compilers

Seconded. My experience:

Taking this course was an great way to learn more about compilers and fill a hole in my CS curriculum. Professor Alex Aiken is a great instructor and covers a good amount of material. I learned a lot about compiler construction despite having toyed with my own compiler before starting the course. The programming assignments were particularly tough, giving me useful experience in building compilers and a great sense of achievement.

(TL;DR from my full blog post: http://dirkjan.ochtman.nl/writing/2012/07/21/compilers-on-co...)

The class is good, but very time-consuming and spends a lot of time on theory. Expect to spend at least 10 hours a week between lectures, quizzes, and the project.

This is more specific to C, but can still be applied to other areas. I always thought it was a great read. A Retargetable C Compiler: Design and Implementation


A port of it to Python would probably be a better place to start. Not many people are conversant in Pascal these days.

It's easy enough to follow along. The snippets are simple enough that anyone who knows a procedural language won't have trouble understanding what they do, and from there it's pretty trivial to write the equivalent code in another language. You can get pretty close by writing C with a few helper functions.

It gives me an excuse to install Free Pascal and give it a whirl though.

That's the spirit!

I've seen Engineering a Compiler get recommended as well, have you read that one?

I have that one on my shelf. It's decent, but it doesn't cover anything that the other two don't. Compared to Engineering a Compiler, the Aho, Sethi, and Ullman book goes into more depth on the theory, and the Appel book has a better breadth of topics. It's not a bad book by any means, but I'd recommend that if you only have the cash for one book, go for the Appel book.

I just looked at the chapters, and it's kind of funny that it gets these accolades despite being written as a 80-char-width text-only file.

Edit: I don't say that to disparage it; I actually think that's an impressive accomplishment.

He's lucky he had an 80-column card! ;-)


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact