Build a Compiler in Five Projects

(kmicinski.com)

70 points | by azhenley 22 hours ago

2 comments

  • AdityaSanthosh 3 hours ago
    Hi, seems like an interesting course. I haven't studied compilers in my undergrad( I'm an electronics student) but I have been working as a programmer who studied c and bit of low level languages. Is there any prerequisite compiler knowledge required for this course?
    • ktimespi 3 hours ago
      The only prerequisite here is probably Racket, to follow along with the book
  • UncleOxidant 3 hours ago
    The Essentials of Compilation book mentioned is only ~$24 on Amazon. Usually books like this are much more expensive. I ordered a copy.
    • almostgotcaught 2 hours ago
      looks like a fun book but just be forewarned real compiler engineering is nothing like what's covered there.
      • anta40 2 hours ago
        Any recommendation for a more realistic book?

        I think hacking GCC/LLVM can be pretty challenging, but hey they are real, production-grade compilers and not just typical academic projects.

        • almostgotcaught 2 hours ago
          there are no good modern compiler books - everything that's been written down pales in comparison to what GCC/LLVM really involve. recently i found Engineering a Compiler by Cooper and Torczon when reviewing/prepping for interviews - it wasn't bad. also there's now LLVM Code Generation by Quentin Colombet but that's basically a code walk-through of LLVM (it doesn't cover any of the algos). and it was probably out of the date the second it got published lol (not really but maybe). the truth is that trying to learn how to build a compiler from a single book is like trying to learn how to build a skyscraper from a single book.
          • kmicinski 1 hour ago
            Respectfully, I think what you mean is that there are no books which give you the experience of hacking on LLVM for several years.
          • yu3zhou4 59 minutes ago
            Is Dragon book still relevant? Do you recommend any other learning resources other than reading the source and contributing to llvm?
            • anta40 35 minutes ago
              I heard that new volume is updated with newer stuffs like data flow analysis, garbage collection, etc. Anyway the book doesn't teach you how to build a basic working compiler, so need to consult another materials.

              Try Andrew Appel's "Modern Compiler implementation in Java/C/ML" or Writing a C Compiler (https://norasandler.com/book) which is much more recent.

              Eventually, you'd want to hack GCC/LLVM because they are production-grade compilers.

      • fragmede 2 hours ago
        Real compiler engineering covers a lot of ground. This book is an intro to it, not the whole everything. No need to posture about it.