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:
  • Curiosity about related minimal interpreters and comparisons to similar projects like SectorLISP
  • ~Criticism that the interpreter is too hacky and takes absurd shortcuts with keyword parsing
  • Disappointment that this isn't really Python but a tiny made-up language
  • Appreciation for the cleverness of techniques like reparsing source for loops
  • Pointing out practical alternatives like Snek for real embedded use cases