tags:

views:

1094

answers:

7

I understand that Parrot is a virtual machine, but I feel like I'm not completely grasping the idea behind it.

As I understand, it's a virtual machine that's being made to handle multiple languages. Is this correct?

What are the advantages of using a virtual machine instead of just an interpreter?

What specifically is Parrot doing that makes it such a big deal?

+12  A: 

Parrot is a bytecode interpreter (possibly with a JIT at a future stage). Think Java and its virtual machine, except that Java is (at the moment) more geared towards static languages, and Parrot is geared towards dynamic languages from the beginning.

Also see Cody's excellent answer! Highly recommended.

Chris Jester-Young
Another important point to mention is that Parrot is register-based intead of stack-based, unlike the JVM and CLR. This can, in theory, make optimization easier as we have much more experience with register-based systems.
Cody Brocious
Cody: You should post that so I can +1 your comment. :-)
Chris Jester-Young
Actually parrot has had jit, for x86 systems at least, for a while now.
Brad Gilbert
+19  A: 

Chris covered the user-facing differences, so I'll cover the other side.

Parrot is register-based rather than stack-based. What that means is that compiler developers can more easily optimize the way in which the registers should be allocated for a given piece of code. In addition, the compilation from Parrot bytecode to machine code can, in theory, be faster than stack-based code since we run register-based systems and have a lot more experience optimizing for them.

Cody Brocious
+22  A: 
brian d foy
Thanks for a good response from a member of the Perl community! I had no votes left, but once the day ticks over (in 15 minutes' time) I'll vote you up. :-)
Chris Jester-Young
+7  A: 

Others have given excellent answers, so what remains for me is to explain what "dynamic" languages actually mean.

In the context of a virtual machine it means that the type of a variable is not known at compile time. In "static" languages the type (or at least a parent class of it) is known at compile time, and many optimizations build on that knowledge.

On the other hand in dynamic languages you might know if a variable holds a container type (like an array) or a scalar (string, number, ...), but you have much less type information at compile time.

Another characteristic is that dynamic languages usually make type conversions much easier, for example in perl and javascript if you use a string as a number, it is automatically converted to a number.

Parrot is designed to make such operations easy and fast, and to allow optimizations without knowing having type informations at compile time.

moritz
+17  A: 

Ah, I've answered this one before.

For those not in the know: Allison is one of the core developers of Parrot.
Jörg W Mittag
Not only that, she's the current architect ;-)
moritz
+2  A: 

Here is The Official Parrot Wiki.

You can find lots of info and links there.

The bottom of the Parrot wiki home page also displays the latest headlines from the Planet Parrot feed aggregator.

In addition to the VM, the Parrot project is building a very powerful tool chain to make it easier to port existing languages, or develop new one.

The Parrot VM will also provide other languages under-the-covers support for many powerful new Perl 6 features (please see the Official Perl 6 Wiki for more Perl 6 info).

Parrot will provide interoperability between modules of differing languages, so that for example, other languages can take advantage of what will become the huge Perl 6 version of CPAN (the vast Perl 5 module archive, which Perl 6 will be able to access via the forthcoming Perl 5.12).

Conrad Schneiker
+1  A: 

Honestly, I didn't know it was that big of a deal. It has come a long way, but just isn't seeing much use. The main target language has yet to really arrive, and has lost a huge mind-share among the industry professionals. Meanwhile, other solutions like .Net and projects like Jython show us that the here-and-now can beat out any perceived hype.

ironfroggy