Skip to content Skip to sidebar Skip to footer

Is There A JavaScript (ECMAScript) Implementation Written In Python?

Are there any JavaScript (ECMAScript) implementations written in pure Python? It is okay even if its implementation is very slow.

Solution 1:

Doesn't seem to be under active development anymore but you could check out pynarcissus, http://code.google.com/p/pynarcissus/source/browse/trunk/jsparser.py

Seems like a binding to V8 (JavaScript interpreter in Google Chromium) is available also, http://www.advogato.org/article/985.html


Solution 2:

There is one, of an unknown level of completeness, written in RPython (a subset of Python, that is to say, it runs as normal Python): https://bitbucket.org/pypy/lang-js/overview


Solution 3:

You may want to take a look at pydermonkey or python-spidermonkey, both of which, I believe, are python implementations of the Mozilla javascript interpreter.


Solution 4:

I would recommend that you just stick to node.js on your local development box, translate your CoffeeScript files over to JavaScript, and deploy the translated scripts with your apps.

I get that you want to avoid having node.js on your servers, that's all fair and good. Jumping through hoops with Python invoking JavaScript to translate CoffeeScript seems more hassle to me than it's worth.


Solution 5:

I created Jispy to embed JS in Python.

From the docs:

A JavaScript Interpreter In Python

Jispy is an interpreter for a strict subset of JavaScript, fondly called LittleJ (LJ). It employs recursive descent for parsing and is very easily extendable.

Built for embedding JavaScript

Jispy's original vision was to seamlessly allow embedding JavaScript programs in Python projects. By default, it doesn't expose the host's file system or any other sensitive element. Some checks on infinite looping and infinite recursion are provided to tackle possibly malicious code.

It comes with an interactive console, so you can get up and running in no time.

Hope this helps.


Post a Comment for "Is There A JavaScript (ECMAScript) Implementation Written In Python?"