targeting the PVM

A

andy

I wan't to write a small compiler for a small language with some experimental
features. I want the target to be portable. I'm evaluating both JVM and Python
Virtual Machine, both of which seem to be appropriate. I have found that the
format of the "JVM machine language" (i.e. class files) is well documented.
However I was not able to find some good documentation on "Python's machine
language".

Can someone provide with pointers?
 
T

Terry Reedy

I wan't to write a small compiler for a small language with some experimental
features. I want the target to be portable. I'm evaluating both JVM and Python
Virtual Machine, both of which seem to be appropriate.

Since it is a somewhat 'private' implementation device for CPython,
the developers retain the right to change the byte code or even
switch, for instance, to a register rather than stack machine.
However, the Python license will allow you to distribute any
particular interpreter (PVM) version for as long as you want.
However I was not able to find some good documentation on "Python's machine
language".

Lib Reg 18.10 dis -- Disassembler for Python byte code
Lib Ref 18.10.1 Python Byte Code Instructions

To learn acual usage, experiment with dis.dis and defed functions or
compile()ed code objects. Example: 0 SET_LINENO 0
3 LOAD_CONST 0 (1)
6 LOAD_CONST 1 (2)
9 BINARY_ADD
10 RETURN_VALUE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top