[pypy-dev] PyVM: Python Bytecode interpreter, in Python

Christian Tismer tismer at tismer.com
Mon Jan 13 02:11:48 CET 2003

Paul Swartz wrote:
> An idea I've been toying around with is a Python bytecode 
> interpreter, written in Python.  Currently, it works 
> decently, supporting pretty much everything except 
> generators.  Might be useful to look at.  The code is 
> available at:  
> http://www.twistedmatrix.com/users/z3p/files/pyvm2.py

Ho hoo!
That's pretty nice to read, something like the
very basic bytecode interpreter, based upon
representations of the internal obejcts, emulated
using Python's basic builtin types.
This looks pretty much like something that Holger
suggested, partially.

It is not implementing the new class/type system,
so I guess it is based upon Python 2.0?
Yes, I see byte_CALL_FUNCTION, which has been split
into some more for 2.2 and up.

I see the individual byte codes being implemented
as small functions. That is very much as I like it.

You are not trying to implement the basic stuff,
but you borrow it from the Python interpreter,
like print. You are also borrowing lists, tuples
and dicts, the interpreter is just a mapping of
bytecodes to builtin actions.
That's fine to start with!

I saw a generator class, at least. This is just
not working, right? I had only five minutes yet
to read it.

Nice thing, thanks for showing it to us!
This is exactly the kind of input we need.

sincerely -- chris
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

More information about the Pypy-dev mailing list