鹦鹉 - 我可以使用它吗?又如何呢?

发布于 2024-10-04 08:43:45 字数 492 浏览 2 评论 0原文

我关注 Parrot 一段时间了。据我了解,它是一个虚拟机,旨在运行各种动态语言,并允许一定程度的互操作性(例如,从 Python 脚本调用 Perl 函数)。所以,我的问题分为两个部分:

  1. Parrot 准备好通用了吗?我可以看到正在发布版本,但尚不清楚它是否现在运行良好,或者仍在进行中。
  2. 有没有关于如何使用 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:

  1. 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.
  2. 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 技术交流群。

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

发布评论

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

评论(2

享受孤独 2024-10-11 08:43:45

我主要是一名 Python 开发人员,所以我有偏见。但可能和你的方向相同。

Parrot 旨在成为一个多语言虚拟机。它的 Perl 根源有时会显示出来(“0”是 false,引导语言 NQP 是 Perl 的子集),但在运行时级别,它与语言无关。

也就是说,语言之间的互操作不会完全无缝。例如,String 类型很可能被所有语言用作基础,但 Ruby 对象可能需要包装器(但不是代理)来表现 Python 风格。还没有关于对象互操作的故事,至少到目前为止还没有。

Python 3 编译器“Pynie”还有很长的路要走。这是存储库 http://bitbucket.org/allison/pynie。也许你想帮忙?现在它还很年轻,甚至还不是物体。

并回答您的实际问题:

  1. 有点。它的速度不快,并且针对它的语言也不完整,但它不会崩溃或损坏您的记忆。
  2. 通常,您使用您最喜欢的高级语言 (Python) 编写代码,并将 .py 代码编译为 parrot(如果您愿意,您可以从那里将其编译为本机代码)。另一个开发人员可以编写他们的 Perl(6) 代码并将其编译为 parrot,如果编译器是在编写时考虑到互操作性的,那么您将能够从 python 调用 Perl 函数

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:

  1. Sort of. It's not fast and the languages that target it aren't complete, but it won't crash or corrupt your memory.
  2. Normally, you write code in your favourite High Level Language (Python) and compile your .py code to parrot (and from there, you can compile it to native code if you want to). Another dev can write their Perl(6) code and compile it to parrot and, if the compilers have been written with interop in mind, you'll be able to call a Perl function from python
雨后咖啡店 2024-10-11 08:43:45
  1. 它仍在进行中,但对于语言实现者和库开发人员来说已经足够成熟。警告:一些子系统正在重新设计(垃圾收集、嵌入),因此前进的道路上可能会遇到一些障碍。

  2. 每种语言都需要一个编译器来生成 Parrot 能够理解的代码。这些编译器是单独发布的。 (请参阅http://trac.parrot.org/parrot/wiki/Languages
    大多数针对 Parrot 的语言都处于早期不完整状态,因此互操作性目前并不是一个大问题。 Parrot 不是 Perl 6 解释器,但 Rakudo Perl 6 恰好是针对 Parrot 开发最完善的编译器之一。

  1. 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.

  2. 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.

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