Introduction to the pygo virtual machine

In the last episode, I have showed a rather important limitation of the tiny-interp interpreter: def cond(): x = 3 if x < 5: return "yes" else: return "no" Control flow and function calls were not handled, as a result tiny-interp could not interpret the above code fragment. In the following, I’ll ditch tiny-interp and switch to the “real” pygo interpreter. Real Python bytecode People having read the AOSA article know that the structure of the bytecode of the tiny-interp interpreter instruction set is in fact very similar to the one of the real python bytecode. [Read More]

A tiny python-like interpreter

Last episode saw me slowly building up towards setting the case for a pygo interpreter: a python interpreter in Go. Still following the Python interpreter written in Python blueprints, let me first do (yet another!) little detour: let me build a tiny (python-like) interpreter. A Tiny Interpreter This tiny interpreter will understand three instructions: LOAD_VALUE ADD_TWO_VALUES PRINT_ANSWER As stated before, my interpreter doesn’t care about lexing, parsing nor compiling. [Read More]