
For all the time reading Habr saw only a few references to Parrot VM. Meanwhile, the project is actively developing, and today release 1.4.0 has been released. Parrot is a virtual machine designed to efficiently compile and execute bytecode for dynamic programming languages. At the moment there are several language implementations for Parrot: Tcl, Javascript, Ruby, Lua, Scheme, PHP, Python, Perl 6, APL, as well as the .NET bytecode translator.
Story
Parrot was originally conceived as a means of implementing Perl 6. The name was chosen after the
April Fool's joke in 2001 about creating a new language based on Perl and Python . March 17, 2009 was the release of Parrot 1.0. By January 2010, production-ready Parrot 2.0 is planned.
Concept
Parrot is designed taking into account the features of dynamic languages, and should run programs on them more efficiently than virtual machines for static languages ββ(JVM, .NET). Parrot supports interoperability between languages ββ- so the class described in Perl can be inherited in python and instantiated in Tcl.
')
Parrot can accept instructions for performance in 4 formats:
- PASM (Parrot Assembly) - the lowest level language for Parrot
- PIL / PIR (Parrot Intermediate Language / Representation) - a small abstraction over PASM
- PAST (Parrot Abstract Syntax Tree)
- PBC (Parrot Bytecode) is the format into which the first three are converted. Executed directly by the virtual machine.
Also in development:
- LevelOne - a new layer of abstraction that gives great opportunities for optimization, such as caching machine code, trace-based JIT (used in TraceMonkey)
- LLVM as a backend for the execution of bytecode
PMC
Parrot is a registered virtual machine (as opposed to JVM and .NET). In addition to the Integer, Number, and String register types, there is another PMC (Polymorphic Container). Through it you can imagine any complex structure - arrays, hash tables, sockets. PMC can be inherited. So, you can create PMC Clousure and Coroutine, and they will have all the properties of PMC Sub.
Implementations of programming languages ββfor Parrot
For Parrot, there is a fairly large number of implementations of programming languages ββof varying degrees of completeness, including Pipp (implementation of PHP), Pynie (implementation of Python), Cardinal (implementation of Ruby) and Rakudo (implementation of Perl6). Full list can be found
here . PCT (Parrot Complier Tools) can be used to create your own implementations. The easiest way to describe the grammar of the language is using PGE (Parrot Grammar Engine - an implementation of Perl 6 Regexes).
Rakudo
The Perl6 implementation, for which Parrot was originally created. Actively developed, the implementation date - 2 days after the release of Parrot (Parrot is released every third Tuesday of the month). About 70% of the test runs now; it is the most promising implementation of Perl6. The progress of the passage of the speeches can be seen
here . As can be seen on the schedule, a lot of work was done during the year.
Web
Developed mod_parrot for Apache, and any implementation of the Parrot language can work with Apache using less than a hundred lines of code.
More information about Parrot and Rakudo can be found at
parrot.org and
rakudo.org . I look forward to January 2010, which is scheduled for Parrot 2.0 releases and fully compliant with the Perl6 Rakudo specification.