Parrot与其他虚拟机相比如何? [英] How does Parrot compare to other virtual machines?

查看:158
本文介绍了Parrot与其他虚拟机相比如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Parrot是最初为Perl 6设计的虚拟机.

Parrot is the virtual machine originally designed for Perl 6.

Parrot VM为竞争虚拟机(例如 Java虚拟机(JVM)<)提供哪些技术功能? /a>/热点VM

What technical capabilities does the Parrot VM offer that competing virtual machines such as the Java Virtual Machine (JVM)/Hotspot VM and Common Language Runtime (CLR) lack?

推荐答案

以下答案写于2009年.另请参见 2015更新.

要在@Reed上进行扩展并指出一些要点,Parrot的操作码要比大多数虚拟机高得多.例如,虽然大多数机器存储整数和浮点数,但是基本寄存器是整数,数字,字符串和Parrot Magic Cookies(PMC).仅内置字符串是从JVM迈出的一步.

To expand on @Reed and point out some highlights, Parrot's opcodes are at a far higher level than most virtual machines. For example, while most machines store integers and floats, the basic registers are integers, numbers, strings and Parrot Magic Cookies (PMCs). Just having strings built in is a step up from the JVM.

更有趣的是PMC,有点像JVM的对象类型,但更容易替代. PMC是您需要的所有其他更复杂类型的容器一种真正的语言,例如数组,表,树,迭代器,I/O等.PMC和各种内置的操作程序对语言编写者来说意味着更少的工作.鹦鹉并没有回避实现一种语言的麻烦但必不可少的部分.

More interesting is the PMC, sort of like JVM's object type but far more fungible. PMCs are a container for all the other more complicated types you need in a real language like arrays, tables, trees, iterators, I/O etc. The PMC and the wide variety of built in ops for it means less work for the language writer. Parrot does not shy away from the messy but necessary bits of implementing a language.

我的信息可能已经过时,但是我相信操作码是可插入的,您可以提供仅包含您的语言所需操作码的Parrot VM.它们也将是可继承的,如果您的语言希望它们的数组与常规的Parrot数组工作有点不同,则可以对其进行子类化.

最后,Parrot不仅可以在汇编器中编写( PASM ),也是一种较高级别的语言,鹦鹉中间表示(PIR). PIR具有循环,子例程,局部变量以及一些基本的数学运算和比较运算,而这是人们在编程语言中所期望的所有基本知识,而无需花太多精力.

Finally, Parrot can be written for not just in assembler (PASM) but also a slightly higher level language, Parrot Intermediate Representation (PIR). PIR has loops, subroutines, localized variables and some basic math and comparison ops, all the basics people expect in a programming language, without getting too far away from the metal.

总而言之,Parrot对想要设计一种语言并将尽可能多的实现留给其他人的语言设计师(由他们并为他们编写)非常友好.

All in all, Parrot is very friendly to language designers (it is written by and for them) who want to design a language and leave as much of the implementation as possible to somebody else.

这篇关于Parrot与其他虚拟机相比如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆