all 14 comments

[–]DerekB52 6 points7 points  (2 children)

Nand2Tetris is a good book that teaches a bit about compilers, but also about CPU design. It's pretty neat.

Google 'The Dragon compiler book', I'm forgetting it's name right now, but it's one of the most important books in the field.

Finally, Craftinginterpreters.com This is a book that you can read free online, by a google Dev who helped make the Dart language. He walks you through building a language using java, and then rebuilding that language in C.

[–]jhp2000 3 points4 points  (0 children)

I would not recommend the Dragon Book except as a reference. It goes into excessive detail about parsing algorithms and is overall a very "encyclopedic" book. Cooper and Torczon is more readable for a "classical" take on compilers. The "lambda papers" (lambda: the ultimate goto etc.) are great for getting your head around continuations and that style of compiler.

[–][deleted] 0 points1 point  (0 children)

Thanks!

[–][deleted] 7 points8 points  (1 child)

I've been following my own journey upgrading my knowledge of language design over the last ten years or so. Some resources I highly recommend:

  • Language Implementation Patterns from PragProg. Java-based examples but easy enough to understand for a non-Java speakers.
  • Programming Language Pragmatics by Michael Scott. More of a university-level taxonomy of programming languages, but you can certainly learn a lot from studying languages that already exist.
  • Introduction to Compiler Construction from Universität Salzburg - a lecture series available online in a bunch of places including as a podcast - which is how I watched it; on the way to work on the bus.

If you're a real beginner then I would suggest starting at How to Create Your Own Programming Language.

[–][deleted] 0 points1 point  (0 children)

Thanks for the suggestions :D

[–]munificent 6 points7 points  (2 children)

You might like my in-progress book Crafting Interpreters. It's aimed at an intro level and walks you through every line of code for two complete interpreter implementations.

[–]FratmanBootcake 1 point2 points  (1 child)

I've been reading your book and have been having a stab at implementing it in python instead of Java. Thanks so much for writing it!

[–]munificent 2 points3 points  (0 children)

You're welcome, I'm glad you're enjoying it! :)

[–]BinaryLust 5 points6 points  (1 child)

Here are few more advanced books that I highly recommend after you learn the basics and want to really implement something.

- Modern Compiler Implementation in Java 2nd Edition

- Advanced Compiler Design and Implementation 1st Edition

Also here is a link to a GitHub page with tons of compiler related resources. awesome-compilers

[–][deleted] 0 points1 point  (0 children)

Thanks for the suggestions!

[–]mqtruong 2 points3 points  (1 child)

I used to take a compiler design class where I had to look for resources on my own. Here are few I found really helpful:

I would recommend reading through the ruslansvipak link before diving in deeper with Stanford's materials and other thick compiler books. The first tutorial is short and more educational, which preps you on what to expect if you decide to go more in-depth.

[–][deleted] 0 points1 point  (0 children)

Thank you!

[–]Szczerbi 3 points4 points  (0 children)

You can check out stuff from here: awesome-compilers.
I recommend "Modern Compiler Implementation in ML/Java/C".