3 ms·
Can the rpython translator support js as a target? Could you compile pypy to js that way, to provide a python environment in existing browsers? To be honest th
by Joeboy 15y ago
Can the rpython translator support js as a target? Could you compile pypy to js that way, to provide a python environment in existing browsers?
To be honest though, JS is a perfectly OK language for web browsers, and if you really want to reuse python code it probably makes more sense to translate it before it gets to the browser, using automated tools or otherwise. Supporting everybody's favourite language natively in every browser would be horrible.
- andybak 15y agoThat's not what the article is proposing.
- tav 15y agoYes, you can compile PyPy to JavaScript. There even used to be a JS backend as part of the RPython translation toolchain, but it got dumped since no-one was interested in working on it [1]. There've been more successful attempts like RPythonic [2] in translating from RPython to JavaScript by going via Emscripten [3], i.e. RPython -> LLVM -> Emscripten -> JavaScript And, then, there have been efforts like my own which have focused on building a WebKit bridge [4] to PyPy. [1] http://www.mail-archive.com/pypy-dev@codespeak.net/msg03946.html http://www.mail-archive.com/pypy-dev@codespeak.net/msg03946.... [2] http://pyppet.blogspot.com/2011/04/rpython-to-javascript.html http://pyppet.blogspot.com/2011/04/rpython-to-javascript.htm... [3] https://github.com/kripken/emscripten https://github.com/kripken/emscripten [4] https://github.com/tav/naaga/tree/master/webkit_bridge https://github.com/tav/naaga/tree/master/webkit_bridge
- jnbiche 15y agoActually, Javascript was originally a target for PyPy, and there was a working implementation before it was dropped since the developers thought that PyPy was being spread too thin; at that time PyPy was already was targeting the JVM, .net, llvm, and C. Note that there is also a working implementation of Javascript that runs on PyPy. This project was actually an implementation of Python that compiled to Javascript as a target.