This is definitely a backend, machine code focused list. If you're writing a compiler to WebAssembly or even the JVM you're probably not gonna need a lot of these resources.<p>Indeed I'd argue that these lists are more for an intermediate compiler writer. Beginner compiler writers don't need to know register allocation. They need to understand how to think about language translation, how to write an intermediate representation, how to learn a target language.<p>I've been toying with the idea of writing a post that goes through the thought process of translation. Specifically, how you build states, and invariants. When I write code generation I spend time thinking about the different states the stack could be in, or what invariant I need to keep across this expression (do I need to save a register or global?).<p>One simple but important example of this is realizing that given a proper, sound type checker, your code generator should almost never give errors. By the time you reach code generation you should have proven enough invariants that code generation cannot fail. This isn't always true but I've found it to be the case.
A lot of ink is spilled on the details of how to make compilers go from taking text and turn it into fast executables, but I believe that the User Experience of compilers is as important a subject as those, but there's very little information about it in the literature, outside of a handful of papers and the design documents of existing compilers that do focus on this.
By the author of the excellent <a href="https://c9x.me/compile/" rel="nofollow">https://c9x.me/compile/</a><p>A lightweight alternative to llvm
<a href="https://c9x.me/compile/doc/llvm.html" rel="nofollow">https://c9x.me/compile/doc/llvm.html</a>
<i>The Zephyr Abstract Syntax Description Language</i>, Wang et al.<p>Has been invaluable for creating the AST (and soon the IR nodes)-- though it has been a source of much yak shaving as I've rewritten my asdl generator at least 3 times.<p><i>Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages
Book</i>, Terence Parr<p>Pretty java/antlr focused but wasn't too hard to take the concepts and apply them to a C++ based transpiler I've been slowly poking at.<p><i>Combining Analyses,
Combining Optimizations</i>, Cliff Click<p>His thesis and an extension of the linked paper <i>Global Code Motion, Global Value Numbering</i> -- my next step down the rabbit hole...<p><i>Tree Automata Techniques and Applications</i>, Comon et al.<p>Still on the fence on this one vs the iburg/burs algorithm, probably be more useful and match better with the way Parr's book goes about things.
I'm not an expert by far, but I feel like many people who write compilers or develop languages no longer recommend The Dragon Book as it's very outdated.<p>Additionally, the vast majority of compiler books and resources spend too much time on the easiest part of compiling: parsing. It's not uncommon for a book or a course dedicate 60-70% of its time to parsing. And leaves nothing to everything else.
Perhaps Cooper's and Torczon's "Engineering a Compiler (2nd Edition)" should be among the entries in the "Books" category.
Alan Holub's 'Compiler Design in C' is not mentioned in the books.
Holub's book had well-written code. I had learned a lot from his code.
Latest versions of the ABI specifications linked in the <i>Machine Specific</i> section<p>ARM: <a href="https://github.com/ARM-software/abi-aa/releases" rel="nofollow">https://github.com/ARM-software/abi-aa/releases</a><p>x86-64: <a href="https://gitlab.com/x86-psABIs/x86-64-ABI" rel="nofollow">https://gitlab.com/x86-psABIs/x86-64-ABI</a> (go to most recent CI job and download artifacts for a compiled PDF)
One thing I find curious: lots of compiler writing seems to be done in Haskell, but I can hardly find any Haskell-based resources for writing compilers.<p>Can anyone here please recommend any such resources?
There is a more recent edition of "Compilers: Principles, Techniques, and Tools" worth considering: <a href="https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd-dp-0321486811/dp/0321486811" rel="nofollow">https://www.amazon.com/Compilers-Principles-Techniques-Tools...</a>.
Does anybody know of good introductory resources on error recovery techniques when writing a parser & interpreter? Bonus points if they use combinators instead of a hand-written parser.
ProTips after writing numerous kinds of compilers in university:<p>Recursive descent with backtracking is much easier to construct and maintain for diagnostics than bison/flex.<p>Derivative parsing is very interesting.