gitmyhub

the-super-tiny-compiler

JavaScript ★ 29k updated 2y ago

:snowman: Possibly the smallest compiler ever

A single, heavily commented JavaScript file that teaches you how compilers work by implementing one from scratch, covering tokenizing, parsing, and code generation in a way that is intentionally tiny and easy to read.

JavaScriptsetup: easycomplexity 2/5

The Super Tiny Compiler is a teaching resource written in JavaScript that walks you through how a compiler works. A compiler is a program that translates code written in one language into another — the tools you use every day (like the ones that turn modern JavaScript into code older browsers can run) are compilers. This project makes the concept approachable by implementing all the essential stages of a compiler in a single, heavily commented JavaScript file that is intentionally small and easy to read. The README acknowledges that compilers have a reputation for being intimidating, and the goal here is to show that the core ideas are actually straightforward once explained clearly. It is a learning tool, not a production-use library. Tests can be run with node test.js. Licensed under Creative Commons BY 4.0.

Where it fits