在哪里可以了解有关 PyPy 翻译功能的更多信息?

发布于 2024-07-04 13:23:07 字数 1560 浏览 7 评论 0原文

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

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

发布评论

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

评论(5

窝囊感情。 2024-07-11 13:23:07

从简单的描述来看,它看起来绝对是革命性的,

据我所知,PyPy 是新颖的,因为它是第一个专门为实现语言而设计的系统。 还有其他工具可以帮助处理前端的大部分工作(例如解析器生成器)或后端(例如代码生成),但用于连接两者的工具并不多。

It looks like something absolutely revolutionary from simply reading the description,

As far as I know, PyPy is novel in the sense that it is the first system expressly designed for implementing languages. Other tools exist to help with much of the very front end, such as parser generators, or for the very back end, such as code generation, but not much existed for connecting the two.

雨后彩虹 2024-07-11 13:23:07

您是在寻找 Python 特定的翻译,还是只是一般的“如何将某些代码编译为字节码”? 如果您是后者,请查看LLVM 教程。 我特别发现第二章很有趣,它教你为自己的语言编写编译器。

Are you looking for Python specific translation, or just the general "how do you compile some code to bytecode"? If the latter is your case, check the LLVM tutorial. I especially find chapter two, which teaches you to write a compiler for your own language, interesting.

伊面 2024-07-11 13:23:07

PyPy 翻译器是一般性的,不适合更多公众使用。 我们用它来翻译
我们自己的Python解释器(包括JIT和GC,都是用RPython编写的,这受到限制
Python 的子集)。 这个想法是,通过良好的 JIT 和 GC,您甚至可以加速
在不知道或使用 PyPy 的翻译工具链的情况下(更重要的是,没有
将自己限制在 RPython 中)。

干杯,
菲哈尔

PyPy translator is in general, not intended for more public use. We use it for translating
our own python interpreter (including JIT and GCs, both written in RPython, this restricted
subset of Python). The idea is that with good JIT and GC, you'll be able to speedups even
without knowing or using PyPy's translation toolchain (and more importantly, without
restricting yourself to RPython).

Cheers,
fijal

陌上青苔 2024-07-11 13:23:07

如果您想要一些实际示例,PyPy 入门文档中有一个标题为“试用翻译器”的部分。

If you want some hand-on examples, PyPy's Getting Started document has a section titled "Trying out the translator".

蝶…霜飞 2024-07-11 13:23:07

该文档似乎涉及相当多的细节(我认为完整的描述超出了 stackoverflow 答案的范围):

从一种语言翻译成另一种语言的总体思路并不是特别具有革命性,但它最近才在“现实世界”应用中变得流行/适用。 GWT 使用 Java(生成 Javascript)执行此操作,并且有一个库可以将 Haskell 翻译成各种其他语言:好吧(称为YHC

This document seems to go into quite a bit of detail (and I think a complete description is out of scope for a stackoverflow answer):

The general idea of translating from one language to another isn't particularly revolutionary, but it has only recently been gaining popularity / applicability in "real-world" applications. GWT does this with Java (generating Javascript) and there is a library for translating Haskell into various other languages as well (called YHC)

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