4 ms·
Pystachio: Python-to-JavaScript translator in JavaScript
- coderdude 17y agoHello HN, I started work on this project a few months back and revisited it last night to get a very early version up. (Release early!) Live demo: http://www.avatrion.com/pystachio/index.html http://www.avatrion.com/pystachio/index.html So far the project consists mainly of a port of Python 2.5's tokenize.py and does not yet perform any actual translation. Pystachio looks for embedded and external scripts with type="text/python" and proceeds to parse the code. The comments in the demo page tell a little more about what's going on and what you can do. Inline python (inside event attributes) is also planned, and an example of how it would be used is included in the demo as well. I'm posting this early to hopefully gather some thoughts from you guys on how to go about translating Python to JavaScript.
- yannis 17y agoYou could check a port of a Pratt parser done by Crockford some years back, can save you a bit of hassle. http://javascript.crockford.com/tdop/tdop.html http://javascript.crockford.com/tdop/tdop.html John Resig's port of processing is also well looking into. Both the above are not python but can give you an indication of how people attacked similar problems in terms of parsing. let us know when you finished:)
- coderdude 17y agoThanks for the tip on processing.js. That and pyjamas might be two good sources for me to pour over.