Re:The Super Tiny Compiler
by userbinator on Thursday March 02, 2023 @10:33PM
(#35005456)
Whenever the subject of tiny learning-oriented compilers comes up, I always recommend C4: https://news.ycombinator.com/item?id=8558822
It's a tiny self-compiling compiler which also includes a bytecode interpreter, and terse but also very understandable.
One of my favorites is the self-hosting Haskell compiler from the 2019 IOCCC: https://www.ioccc.org/2019/lynn/hint.html
There is a series of articles on how it was built here: https://crypto.stanford.edu/~blynn/compiler/
It turns out the compiler in the article is the opposite of that. It it a simple toy transpiler and the code is very clear and mostly made of comments. The former is a feat of optimization, the latter is a tutorial.