Anyone know a good resource for getting started writing a compiler? I'm not trying to write a new LLVM, but being a "software engineer" writing web-based APIs for a living is leaving me wanting more.
The dragon book is a classic, and was a terrific resource thirty and forty years ago. Today there are many far better resources. Several listed adjacent to this one.
It’s focused on theory and very heavy on parsing. All of that is fine, but not especially useful for the hobbies.
I am currently going through that book. I recommend it with one caveat: you'll need to have written some interpreters before (Crafting Interpreters is a perfect starting point) because it expects you to already know some things like to how write a simple recursive decent parser.
- Writing a Compiler is Surprisingly Easy - https://news.ycombinator.com/item?id=38182461
- Write your own retro compiler - https://news.ycombinator.com/item?id=38591662
- Compiling a Lisp - https://news.ycombinator.com/item?id=39216904
- Writing a C Compiler - https://news.ycombinator.com/item?id=41227716
- Compilers: Incrementally and Extensibly - https://news.ycombinator.com/item?id=43593088
- Working through 'Writing a C Compiler' - https://news.ycombinator.com/item?id=44541565
- Build a Compiler in Five Projects - https://news.ycombinator.com/item?id=46031220
Personally I found Crafting Interpreters to be a terrific introduction to the key concepts: https://craftinginterpreters.com
(But I'm just a kibitzer, I've never written anything more serious than a DSL in Perl.)