finds.dev← search

// the find

jamiebuilds/the-super-tiny-compiler

★ 28,553 · JavaScript · CC-BY-4.0 · updated Feb 2024

:snowman: Possibly the smallest compiler ever

A single 200-line JavaScript file that implements a toy Lisp-to-C compiler — tokenizer, parser, transformer, and code generator — with heavy inline comments explaining each phase. It exists purely as a teaching tool; you would never use it in production. It's for developers who keep bouncing off compiler theory and want something concrete to read instead.

The inline comments are genuinely good — they explain *why* each phase exists, not just what the code does. Walking tokenizer → AST → transformed AST → output in one file makes the data flow obvious in a way that reading LLVM docs never will. The test file is minimal but shows exactly what the compiler accepts and produces, so you can tinker without guessing. 28k stars is social proof that this scratch-the-surface approach actually works for people.

It stops at the point where compilers get interesting — no type system, no symbol table, no error recovery, no intermediate representation worth the name. The 'Lisp' it parses is so stripped-down it barely qualifies; add one nested function call and you'll see where the abstractions break. It hasn't been touched since early 2024, and there are no issues or PRs being responded to, so if you hit a bug you're on your own. It also won't point you to what to read next — you'll finish it and still have no map for going deeper.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →