鹦鹉 - 我可以使用它吗?又如何呢?
我关注 Parrot 一段时间了。据我了解,它是一个虚拟机,旨在运行各种动态语言,并允许一定程度的互操作性(例如,从 Python 脚本调用 Perl 函数)。所以,我的问题分为两个部分:
- Parrot 准备好通用了吗?我可以看到正在发布版本,但尚不清楚它是否现在运行良好,或者仍在进行中。
- 有没有关于如何使用 Parrot 的文档?我查看了之前问题中的链接,但我能找到的所有文档都讨论了 Parrot 特定代码的各个级别(PIR、PASM 等),或如何添加对更多语言的支持。太好了,但是如何在 Parrot 上运行现有语言的代码呢?如何使用用另一种语言编写的代码?
最后,我不想引发一场口水战,但我知道 Parrot 与 Perl 6 息息相关。我更喜欢 Python。我知道 Python 是一种受支持的语言,但实际上,它是被视为多语言 VM,还是作为好奇心包含其他语言的 Perl 6 解释器?
I've had an eye on Parrot for a little while. I understand that it's a virtual machine designed to run a variety of dynamic languages, and to allow a degree of interoperability (e.g. calling a Perl function from a Python script). So, my question is in two parts:
- Is Parrot ready for general use? I can see releases are being made, but it's not obvious whether it's something that works well now, or still a work in progress.
- Is there any documentation on how to use Parrot? I've looked at links in previous questions, but all the documentation I can find talks about the various levels of Parrot-specific code (PIR, PASM, etc.), or how to add support for more languages. That's great, but how do I run code in existing languages on Parrot? And how do I use code written in another language?
Finally, I don't want to start a flamewar, but I know Parrot is tied up with Perl 6. I prefer Python. I understand Python is a supported language, but realistically, is it perceived as a multi-language VM, or is it a Perl 6 interpreter with other languages included as curiosities?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我主要是一名 Python 开发人员,所以我有偏见。但可能和你的方向相同。
Parrot 旨在成为一个多语言虚拟机。它的 Perl 根源有时会显示出来(“0”是 false,引导语言 NQP 是 Perl 的子集),但在运行时级别,它与语言无关。
也就是说,语言之间的互操作不会完全无缝。例如,String 类型很可能被所有语言用作基础,但 Ruby 对象可能需要包装器(但不是代理)来表现 Python 风格。还没有关于对象互操作的故事,至少到目前为止还没有。
Python 3 编译器“Pynie”还有很长的路要走。这是存储库 http://bitbucket.org/allison/pynie。也许你想帮忙?现在它还很年轻,甚至还不是物体。
并回答您的实际问题:
I'm a Python developer primarily, so I'm biased. But probably in the same direction as you.
Parrot is intended to be a multi-language VM. Its Perl roots show sometimes ("0" is false, the bootstrapping language NQP is a subset of perl), but at the runtime level it's quite language-agnostic.
That said, interop between languages won't be entirely seamless. For example, the String type will most likely be used as a base by all languages, but a Ruby object will probably need wrappers (but not proxies) to act pythonic. There's no story for object interop, at least not so far.
The Python 3 compiler "Pynie" has quite a way to go. Here's the repo http://bitbucket.org/allison/pynie. Maybe you'd like to help out? Right now it's quite young, not even objects yet.
And to answer your actual question:
它仍在进行中,但对于语言实现者和库开发人员来说已经足够成熟。警告:一些子系统正在重新设计(垃圾收集、嵌入),因此前进的道路上可能会遇到一些障碍。
每种语言都需要一个编译器来生成 Parrot 能够理解的代码。这些编译器是单独发布的。 (请参阅http://trac.parrot.org/parrot/wiki/Languages)
大多数针对 Parrot 的语言都处于早期不完整状态,因此互操作性目前并不是一个大问题。 Parrot 不是 Perl 6 解释器,但 Rakudo Perl 6 恰好是针对 Parrot 开发最完善的编译器之一。
It is still work in progress, but it's mature enough for language implementors and library developers. Caveat: some subsystems are getting reworked (garbage collection, embedding), so there might be some bumps on the road ahead.
Each language needs a compiler that generates code Parrot understands. These compilers are released separately. (see http://trac.parrot.org/parrot/wiki/Languages )
Most languages targeting Parrot are in an early incomplete state, so interoperability isn't a big issue right now. Parrot isn't a Perl 6 interpreter, but Rakudo Perl 6 happens to be one of the most heavily developed compiler that targets Parrot.