A hands-on approach to understanding and building compilers using the programming language Python. Compilers are notoriously difficult programs to teach and understand. Most books about compilers dedicate one chapter to each progressive stage, a structure that hides how language features motivate design choices. By contrast, this innovative textbook provides an incremental approach that allows students to write every single line of code themselves. Jeremy Siek guides the reader in constructing their own compiler in the powerful object-oriented programming language Python, adding complex language features as the book progresses. Essentials of Compilation explains the essential concepts, algorithms, and data structures that underlie modern compilers and lays the groundwork for future study of advanced topics. Already in wide use by students and professionals alike, this rigorous but accessible book invites readers to learn by doing. Deconstructs the challenge of compiler construction into bite-sized pieces Enhances learning by connecting language features to compiler design choices Develops understanding of how programs are mapped onto computer hardware Classroom-tested, hands-on approach suitable for students and professionals Extensive ancillary resources include source code and solutions
https://nostarch.com/writing-c-compiler - Writing a C Compiler by Nora Sandler, language agnostic for the implementation.
https://mitpress.mit.edu/9780262047760/essentials-of-compila... - Essentials of Compilation (using Racket) by Jeremy Siek
https://mitpress.mit.edu/9780262048248/essentials-of-compila... - Essentials of Compilation (using Python) by Jeremy Siek
Those last two both have open access versions.
You can work through a book that uses a more modern approach like Siek's Essentials of Compilation which comes in Racket [0] and Python flavors.
Teach Yourself CS also has some more classic recommendations [1].
You may also be interested in using a language from the ML family [2] to implement a compiler [3].
Cornell also has a self-paced graduate level course [4].
This page also has a bunch of recs [5].
[0] https://mitpress.mit.edu/9780262047760/essentials-of-compila...
[1] https://teachyourselfcs.com/#languages
[2] https://matt.might.net/articles/best-programming-languages/
https://mitpress.mit.edu/9780262047760/essentials-of-compila... - Jeremy Siek's Essentials of Compilation (there's also a Python version)
Admittedly I didn't finish working through it (life got in the way), but I worked through a good chunk of it with a colleague from a non-CS background. He wanted to understand compilers and it seemed to be much more effective than other texts he'd tried to work through. I'll have to look at this one at some point, probably this summer when things are usually calmer for me.
This book is open access, https://github.com/IUCompilerCourse/Essentials-of-Compilatio... both the Python and the Racket versions.
If you are the kinda nerd that has nerd book club with friends, this is book is perfect for it.