3 ms·
Nowadays I’ve heard recommended Crafting Interpreters. (https://craftinginterpreters.com https://craftinginterpreters.com) The Nanopass paper link doesn’t work
by armchairhacker 6mo ago
Nowadays I’ve heard recommended Crafting Interpreters. (https://craftinginterpreters.com https://craftinginterpreters.com)
The Nanopass paper link doesn’t work.
- ramon156 6mo agoAwesome course! finished it while i was doing my final CS year because I had to wait on a bunch of classes (and frankly had no one to talk to before classes). I haven't tried nanopass, but there's other links that work, so I'll give it a go.
- tmountain 6mo agoIncredible book for self guided learning!
- gobdovan 6mo agoCompilers are broad enough that when someone recommends a "compiler book", it's rarely exactly the slice you wanted. So this made me do a runnable cheat sheet for Crafting Interpreters. I keep parsing demonstrative, and the AST is a little more Lisp-y than the book's. Disclaimer: it's meant to convey the essence of what you'll learn, it is NOT by any means a replacement for the book. I'd also describe the book as more of an experience (including some things Nystrom clearly enjoyed, like the visitor pattern) than a compilers manual. If anyone's interested, I can do a separate visitor-pattern cheat sheet too, also in Python. I turned it into a 'public-facing artifact' from private scripts with an AI agent. [0] https://ouatu.ro/blog/crafting-interpreters-cheat-sheet/ https://ouatu.ro/blog/crafting-interpreters-cheat-sheet/
- orthoxerox 6mo agoCrafting Interpreters is great, I wish it had a companion book that covered: - types and typing - optimization passes - object files, executables, libraries and linking Then two of them would be sufficient for writing a compiler.
- gavinray 6mo agoTo your last point, "Linkers and Loaders" has no equal despite being a bit dated
- ux266478 6mo ago> types and typing This would be like asking for a book on designing grammar. It's just too disjoint of a field to have any kind of reasonable baseline, and it's drop dead easy to grok a basic one together. With those two things being equal, just like with grammar, the answer to this is any resource about implementing the language you're trying to ape.
- orthoxerox 6mo agoIt's drop dead easy to grok a basic one together until you get to hairy stuff like overloading, lambdas and generics. The reasonable baseline would be something like Java 1. Scalars, arrays and classes. If I remember correctly, Lox even skips arrays as an exercise for the user.
- ux266478 6mo agoThe problem is in the case of overloading or lambdas being "hairy", it follows you're well outside the scope of a beginner. Generics are explicitly outside the scope of a beginner learning to implement a basic type system. In the case you're not a beginner, it's not true that no literature exists on type systems and their implementation. The mountain of literature is essentially inexhaustible, but if you're still wondering about how to implement any type system at all, if you've never done it before, you really need to not worry so much about that. Kind of like how you don't even think about implementing a tracing jitter before you've written the world's shittiest tree-walking interpreter.
- duped 6mo ago> types and typing Types and Programming Languages, Benjamin C Pierce > object files, executables, libraries and linking Linkers and Loaders, John R Levine
- menato 6mo agoIt was saved: https://github.com/asalber/books/blob/master/A%20Nanopass%20Framework%20for%20Compiler%20Education.pdf https://github.com/asalber/books/blob/master/A%20Nanopass%20...
- gbacon 6mo agoAlso: https://github.com/joseluisq/technically-oriented-pdf-collection/blob/master/A%20Nanopass%20Framework%20for%20Compiler%20Education.pdf https://github.com/joseluisq/technically-oriented-pdf-collec...
- raxxorraxor 6mo agoMany languages like Pancake Stack are looking for efficient interpreters: https://esolangs.org/wiki/Pancake_Stack https://esolangs.org/wiki/Pancake_Stack :)