Software engineer Austin Henley built a Python interpreter that compiles to exactly 1024 bytes of C code, according to his blog post.

The interpreter runs programs with variables, arithmetic, comparisons, if/else logic, while and for loops, and recursive function calls, Henley wrote. Instead of building an abstract syntax tree or bytecode, it tracks a handful of global variables and executes expressions as it parses them. Loops work by jumping backward in the source and reparsing it on every pass, rather than compiling the loop body once.

Getting there took aggressive code golf: single-letter variable and function names, ASCII values in place of character literals, and bitwise operations standing in for more readable logic, according to the post. The readable version of the same interpreter ran past 4,800 bytes before Henley compressed it.

The final interpreter can't handle scoped variables, function arguments or chained comparison expressions, though truthiness checks work without them, Henley wrote.

It's a toy, and Henley says as much, but it's also a clean demonstration that an interpreter doesn't need a parser generator or a virtual machine to run real control flow. It needs a loop willing to redo work it already did.