| Making a Python interpreter in 1024 bytes(austinhenley.com) | |
| 310 points by azhenley 3 days ago | 104 comments | |
tl;dr: Austin Henley built a Python-like interpreter in exactly 1024 bytes of C, supporting features like integer variables, arithmetic, if/else, while and for loops, function definitions, and recursion, enough to run FizzBuzz. The interpreter skips tokenization/AST/bytecode entirely, executing directly via recursive descent and handling loops by rewinding and reparsing the source. Heavy code-golfing tricks (C89 implicit int, ASCII literals, globals as temps, bitwise ops) were needed to hit the size limit, shrinking a ~4800-byte readable version down to 1024. | |
HN Discussion:
| |