pyjamas pyv8run converts python to javascript, executes under command-line

lkcl luke.leighton at googlemail.com
Sun Sep 20 17:51:15 EDT 2009


On Sep 19, 8:36 pm, Daniel Fetchinson <fetchin... at googlemail.com>
wrote:
> >> the pyjamas project is taking a slightly different approach to achieve
> >> this same goal: beat the stuffing out of the pyjamas compiler, rather
> >> than hand-write such large sections of code in pure javascript, and
> >> double-run regression tests (once as python, second time converted to
> >> javascript under pyv8run, d8 or spidermonkey).
>
> >> anyway, just thought there might be people who would be intrigued (or
> >> horrified enough to care what's being done in the name of computer
> >> science) by either of these projects.
>
> > I've added pyjamas to the implementations page on the Python Wiki in
> > the compilers section:
>
> >http://wiki.python.org/moin/implementation
>
> In what way is pyjamas a python implementation? As far as I know
> pyjamas is an application written in python that is capable of
> generating javascript code.

 it's strictly speaking, according to wikipedia, a "language
translator".  i'm just in the process of adding an AST parser (based
on lib2to3, from sgraham's work in skulpt) which will become the basis
of an "exec" function, just like in the skulpt demo.

 also to answer your question: pyjamas has [roughly] two modes: -O and
--strict.  "-O" is the one where you have to write in a subset of
python, and you can (unfortunately) do things like 5 + "px" (which
doesn't throw an exception).  this saves _vast_ amounts of CPU
cycles.

"--strict" as you would expect is the python-strict converter, where
we're beginning to add implementations of __add__ etc. etc. and
generally cope with the nasty grungy bits of javascript that would
otherwise make arbitrary python applications keel over.

l.



More information about the Python-list mailing list