My favorites | Sign in
Project Home Wiki Source
Project Information
Members
Links

PEJS

Python Executed by JavaScript

The project aims at implementing a Python VM in JavaScript, enabling Python on web pages in browsers all over the world :)

For now, this is done by executing Python Byte Code Instructions as outputted by the standard CPython implementation, but the perspectives are laid out by HotRuby, where nested Ruby code is run straight out of the HTML.

This project is sort of a Python equivalence to HotRuby.


School project

At the moment, this is a school project as part of the course Design of Virtual Machines for Object Oriented Languages at DAIMI, the computer science department at University of Aarhus. The course is held by Lars Bak and his staff at Google Aarhus, the V8 team.


Details

Our aim is to implement an object-oriented subset of Python bytecode.

Our approach is as follows:

We've started by implementing a simple interpreter (src/interpreter.js) which simply switches over the bytecodes and implements only some very basic language constructs. The Python bytecode is actually generated by a Python program (tools/pejs.py) which outputs it in JavaScript arrays.The JavaScript file containing the bytecodes is then referenced in an HTML-file which also references our interpreter and thus the Python code is executed in the browser.

For a complete Python implementation we would have to write a Python compiler as well as the virtual machine we are doing.

Milestones

Week Milestone Details
44 Up and running Simple interpreter operating on a stack
45 Basic constructs Implemented jumps and loops
46 Object and Memory model Decide on object representation and heap layout
47 Object and Memory model Implement classes and objects
48 Garbage collector Simple garbage collector if needed
49 Library calls Handle calls to python library somehow
50 Performance evaluation Report
51 Deadline Report

We aim to finish the basic language features (variables, conditionals, loops, functions) and then design and implement classes and objects which implies designing an object and a memory model. This is the most important part of the project.

After that, we would like to handle garbage collection as well as library calls. It is not yet clear how far we will get with regard to these two issues. That depends on how complex the object implementation turns out to be.

Finally we document our implementation with performance evaluations where we would like to consider different JavaScript VM's for executing our own VM as well as implementation alternatives inside our VM.

Powered by Google Project Hosting