3 ms·
I just can't get myself to love JS the way I do other languages... so, this is my current little weekend project. It's a source-to-source translator so it inte
by s3graham 17y ago
I just can't get myself to love JS the way I do other languages... so, this is my current little weekend project.
It's a source-to-source translator so it interops reasonably with JS and should perform similarly also.
The parser is derived from CPython's so that part is relatively complete, but the "backend" isn't done yet. For example, there's not even support for "class" yet.
- mahmud 17y agoNeat little thing. Feared and appreciated comprehensively.
- dtf 17y agoVery impressive work. But you'll need to implement "import this" for it to be considered a serious Python implementation.
- dkersten 17y agoGood point
- kevindication 17y agoAny support at all for modules is really a requirement to be considered a serious Python implementation. >>> import sys don't have handler for: import_stmt But otherwise, neato.
- snprbob86 17y agoDid you evaluate PyPy? I think they already have a significant RPython->Javascript backend.
- s3graham 17y agoLink? I don't see it at http://codespeak.net/pypy/dist/pypy/doc/docindex.html#pypy-directory-cross-reference http://codespeak.net/pypy/dist/pypy/doc/docindex.html#pypy-d... (a js interpreter, but no translator). If I were to guess, not having seen PyPy's: I'd like something about 100x smaller than PyPy seems to be, and I don't want a mandatory up-front translation "build" step.
- snprbob86 17y agoApparently they removed it: http://www.mail-archive.com/pypy-dev@codespeak.net/msg03946.html http://www.mail-archive.com/pypy-dev@codespeak.net/msg03946.... That post also mentions Pyjamas, a port of Google Web Toolkit which compiles Python instead of Java: http://pyjs.org/ http://pyjs.org/
- tome 17y agoWell this is very annoying as I had started to use PyPy's Javascript backend in metapaw-dip: http://www.metapaw.co.uk/projects/metapaw-dip/ http://www.metapaw.co.uk/projects/metapaw-dip/ I really, really want to do Python client-side (or rather compile Python to Javascript). Javascript is just so painful for me. Being able to test Python code as Python would be the major reason.
- pmorici 17y agoWhat version of the language is this and what subset of stuff works, it seems like everything I try gives me some kind of error, maybe I'm just picking the wrong things. like it lets me create a dictionary but if I try to call the iterkeys() method it doesn't like that, and the built-in function dir() doesn't work. It has range() but not xrange()? Cool none the less.
- s3graham 17y agoThe version is the "still lame" version where I haven't implemented those functions yet. :) Parser-wise it's 2.6.2, but those functions you mention are in C code in real-Python, so I need to (re-)write them in JS. You can see the list of supported global functions and method functions if you grab the source off bitbucket. (Incidentally, "for x in a_dict" will work the same as iterkeys currently)
- irrelative 17y agoI was just looking at the source, and I want to compliment you on how good it looks. Very well done -- really organized and thought out with much less hackery than expected (which JS seems to have a tendency to bring out...)