
* https://interpreterbook.com/
Somewhat more practical:
* https://www.craftinginterpreters.com/
...
massive gap here
...
Serious:
* Engineering a Compiler (even this wastes soooo much time on parsing)
* Optimizing Compilers for Modern Architectures
* Advanced Compiler Design and Implementation
I'm not exaggerating or being contrary for the sake of it when I say disregard the Dragon book - we don't build compilers like that any more. It's not even like it teaches you the foundations that are still useful because I think the foundations and what we emphasise as important now have changed so much.
* Lexing/parsing
* Classical scalar optimizations
* Loop (vector) optimizations
* Code generation trifecta of scheduling, register allocation, and peepholes
* Dataflow and static analysis
* Interprocedural, link-time, and whole-program optimization
* JITs (to the extent that it differs from the above)
* Garbage collection
* A variety of advanced topics, such as decompilation, dynamic binary analysis/rewriting, superoptimization, formal verification, etc.
There's no resource that's going to cover everything well, and some of them (particularly the last topic) are going to best covered by reading the research papers that come out at the premier compiler conferences such as PLDI. The Dragon book, for example, mostly covers parsing, classical scalar optimizations, and code generation, giving you very little to go on for interprocedural optimization, for example. Allen & Kennedy's "Optimizing Compilers for Modern Architectures" is going to be a better resource for loop optimization.
If you want to get these textbooks for a cheaper price, try finding a nearby university, looking up when they offer a compiler course, and seeing if the bookstore has a used copy before the semester starts. I was lucky in that the compiler class had been cancelled immediately before the semester started, so the entire pallet of books was available, offering me my choice of highest quality used book.
Engineering a Compiler.
Managing Gigabytes.
Advanced Programming in the Unix Environment
Unix Network Programming
On Lisp
Advanced Compiler Design and Implementation
Concepts, Techniques and Models of Computer Programming
Design Concepts in Programming Languages
Lambda-Calculus and Combinators (the new Hindley/Seldin book, just got it 2 weeks ago)
Optimizing Compilers for Modern Architectures
Abstract Computing Machines: A Lambda-Calculus Perspective
I'm curious what you'd recommend.
For what it's worth my goal was to compile to machine code. Anything less would have seemed insufficient. Later I got Appel's "Modern Compiler Implementation in Java" and Allen and Kennedy "Optimizing Compilers for Modern Architectures".
Cooper and Torczon "Engineering a Compiler" was recommended here recently. I haven't seen it.
Another space you can look for interesting things (not necessarily optimising compilation) is the compilation of functional programming languages. They usually take a slightly different approach compared to imperative languages, though there's clearly a lot of overlap. I really enjoy reading in an old book called The Implementation of Functional Programming Languages from 1987, which is available online: http://research.microsoft.com/en-us/um/people/simonpj/papers...