We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
据我所知,PyPy 是新颖的,因为它是第一个专门为实现语言而设计的系统。 还有其他工具可以帮助处理前端的大部分工作(例如解析器生成器)或后端(例如代码生成),但用于连接两者的工具并不多。
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.
您是在寻找 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.
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
如果您想要一些实际示例,PyPy 入门文档中有一个标题为“试用翻译器”的部分。
If you want some hand-on examples, PyPy's Getting Started document has a section titled "Trying out the translator".
该文档似乎涉及相当多的细节(我认为完整的描述超出了 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)