是否有用 Python 编写的 JavaScript (ECMAScript) 实现?

发布于 2024-12-05 04:53:51 字数 83 浏览 0 评论 0原文

是否有任何用 Python 编写的 JavaScript (ECMAScript) 实现?即使它的实施很慢也没关系。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

饮湿 2024-12-12 04:53:52

您听说过 PyV8 吗?它是 Google V8 JavaScript 引擎的 Python 包装器。这可能就是您正在寻找的。

Have you heard of PyV8? It's a Python wrapper of Google's V8 JavaScript engine. It may be what you're looking for.

別甾虛僞 2024-12-12 04:53:51

似乎不再处于积极开发状态,但您可以查看 pynarcissushttp://code.google.com/p/pynarcissus/source/browse/trunk/jsparser.py

似乎是到 V8 的绑定(JavaScript 解释器Google Chromium)也可用,http://www.advogato.org/article/985.html< /a>

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

平定天下 2024-12-12 04:53:51

有一个用 RPython(Python 的子集,也就是说,它像普通 Python 一样运行)编写的,完整性级别未知: https://bitbucket.org/pypy/lang-js/overview

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

柒七 2024-12-12 04:53:51

您可能需要查看 pydermonkeypython-spidermonkey,我相信,这两个都是 Mozilla javascript 解释器的 python 实现。

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.

裸钻 2024-12-12 04:53:51

我建议您在本地开发盒上坚持使用 Node.js,将 CoffeeScript 文件转换为 JavaScript,然后将翻译后的脚本部署到您的应用程序中。

我知道您希望避免在服务器上安装 Node.js,这很公平而且很好。在我看来,使用 Python 调用 JavaScript 来翻译 CoffeeScript 似乎比其价值更麻烦。

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.

夜夜流光相皎洁 2024-12-12 04:53:51

我创建了 Jispy 将 JS 嵌入到 Python 中。

来自文档:

Python 中的 JavaScript 解释器

Jispy 是 JavaScript 严格子集的解释器,被亲切地称为 LittleJ ( LJ)。它采用递归下降进行解析,并且非常容易扩展。

专为嵌入 JavaScript 而构建

Jispy 最初的愿景是允许在 Python 项目中无缝嵌入 JavaScript 程序。默认情况下,它不会暴露主机的文件系统或任何其他敏感元素。提供了一些对无限循环和无限递归的检查来解决可能的恶意代码。

它配备了交互式控制台,因此您可以立即启动并运行。

希望这有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文