Python interpreter in python?

arcege at arcege at
Fri Dec 22 14:56:52 EST 2000

Chui Tey <teyc at> wrote:
: Is there a python implementation of the python VM? Basically for
: experimenting?

I would start first by looking at the code module, it is a full Python
interpreter written in Python.  If I remember correctly, there was talk
a while ago that Python 2 (P3K?) would have a Python-coded interpreter
instead of C based.  Guido wrote the Idle interactive shell with this
module (c.f. Tools/idle/

If you still want to look into emulating the VM, then first look into
the parser modules and how it builds the VM instructions (the "Python
Language Services" in the Library Reference manual).  From there, you
can more easily handle the byte-codes and interpret data.  I would
especially look at section "Emulation of compile()" (while not
a large section, it gives you pointers on where to go).  Then from
there, look at writing eval/exec in Python.


More information about the Python-list mailing list