Austin Henley ships 1024-byte C interpreter for Python subset with single-char vars and indent-based blocks
Henley’s 1024-byte C interpreter demonstrates that a recognizable Python subset can execute inside extreme binary constraints by sacrificing variables, error handling, and data structures. The approach trades completeness for size while relying on C recursion for block management. No benchmark or extended test suite accompanies the release.
Henley stores the entire source in a 999-byte char array and maintains a 256-entry int symbol table for variables and loop counters. Expressions use recursive descent with on-the-fly evaluation; loops rewind the position pointer to reparse the condition each iteration. The run_block function tracks indentation depth to decide when to return, leveraging the C call stack for nesting. No AST, bytecode, or error paths exist.
The implementation accepts only lowercase single-letter identifiers, strips most whitespace outside strings, and assumes syntactically correct input. It correctly runs the posted FizzBuzz yet omits function arguments, lists, and exception handling. Compared with MicroPython’s 100 kB+ footprint or the full CPython tokenizer, the 1024-byte limit forces these constraints. Earlier 512-byte attempts failed once control flow was added.
The work reveals that indentation-driven control flow and a minimal symbol table suffice for recognizable Python syntax inside extreme size limits. It also exposes the absence of any verification suite or performance data, leaving claims of “Python-like” behavior unquantified beyond one example. Future iterations could test whether adding 8-bit integers or simple function calls stays inside 2048 bytes.
Operational impact is limited to educational demos and code-golf contests; production use is precluded by missing safety checks and the fixed 999-byte source cap.
Henley: working 2048-byte build supporting 2-argument functions passes FizzBuzz plus factorial by December 2025
Sources (3)
- [1]Primary Source(https://austinhenley.com/blog/python1024.html)
- [2]Supporting Source(https://github.com/micropython/micropython)
- [3]Supporting Source(https://github.com/python/cpython/blob/main/Python/ast.c)