3 ms·
Wirth's classic recursive descent Pascal compiler in his 1976 book Algorithms + Data Structures = Programs is a basic compiler for a somewhat useful language. T
by Animats 3y ago
Wirth's classic recursive descent Pascal compiler in his 1976 book Algorithms + Data Structures = Programs is a basic compiler for a somewhat useful language.
That's kind of dated. What's a modern equivalent?
- bartekpacia 3y agoCrafting Interpreters?
- ramon156 3y agoI'd argue that crafting interpreters is becoming dated as well. There are modern alternatives that could make the process a lot more streamline. Would love a rewrite!
- GuestHNUser 3y agoCould you expand on what alternatives you prefer? I'm not sure what is dated about Crafting Interpreters (but I'm also not following the latest developments in the compiler space). Thorston Ball's Compiler and Interpreter book series is the only other book on the subject I find widely recommend and modern.
- codr7 3y agoIf you don't mind interpreters and/or swift, I'm working on a tutorial here: https://github.com/codr7/swift-interpreter https://github.com/codr7/swift-interpreter
- dna_polymerase 3y agoI keep recommending “Compiling to Assembly”, by Vladimir Keleshev: https://keleshev.com/compiling-to-assembly-from-scratch/ https://keleshev.com/compiling-to-assembly-from-scratch/ The author chose TypeScript for the Compiler, which makes it somewhat more accessible to these days programmers.
- Jtsummers 3y agohttps://mitpress.mit.edu/author/jeremy-g-siek-37497/ https://mitpress.mit.edu/author/jeremy-g-siek-37497/ - He has two books, both are also available through open access. One is in Python implementing a Python-ish language and the other in Racket implementing a Scheme-ish language. I ran through the first half or so of both versions earlier this year while looking for material for a colleague (and a few other books, courses, and tutorials). Overall I like the approach which is based on the nanopass compiler concept mentioned by some other commenters. You get a functioning compiler (as in it produces an executable program) very early, and then spend the rest of the book extending the language and adding passes.