Back to Home

Parrot 1.4.0 Mundo Cani Released

For all the time of reading the 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 ...

Parrot 1.4.0 Mundo Cani Released

    Parrot LogoFor all the time of reading the 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. Currently there are several language implementations for Parrot: Tcl, Javascript, Ruby, Lua, Scheme, PHP, Python, Perl 6, APL, as well as .NET bytecode translator.


    Story


    Initially, Parrot was conceived as a means of implementing the Perl 6 language. The name was chosen after the April Fools' joke in 2001 about creating a new language based on Perl and Python . March 17, 2009 saw 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 execute programs on them more efficiently than virtual machines for static languages ​​(JVM, .NET). Parrot supports interoperability between languages ​​- thus, the class described in pearl can be inherited in python and instantiated in Tcl.

    Parrot can accept instruments for execution 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) - the format in which the first three are converted. Executed directly by the virtual machine

    Also in development:
    • LevelOne - a new layer of abstraction, giving great opportunities for optimization, such as caching machine code, trace-based JIT (used in TraceMonkey)
    • LLVM as a backend for executing bytecode


    PMC


    Parrot is a register-based virtual machine (unlike JVM and .NET). In addition to the register types Integer, Number and String, there is one more - PMC (Polymorphic Container). Through it, you can imagine any complex structure - arrays, hash tables, sockets. PMCs can be inherited. So, you can create PMC Clousure and Coroutine, and they will have all the properties of PMC Sub.

    Implementation of programming languages ​​for Parrot


    For Parrot, there are a fairly large number of implementations of programming languages ​​of varying degrees of completeness, among which are Pipp (PHP implementation), Pynie (Python implementation), Cardinal (Ruby implementation) and Rakudo (Perl6 implementation). The full list can be found here . You can use PCT (Parrot Complier Tools) to create your own implementations. The easiest way to describe a grammar is with PGE (Parrot Grammar Engine - Perl 6 Regexes implementation).

    Rakudo


    Perl6 implementation for which Parrot was originally created. It is being actively developed, the implementation date is 2 days after the release of Parrot (Parrot will be released every third Tuesday of the month). Now about 70% of the tests are held, is the most promising implementation of Perl6. You can see the progress of the tests here . As can be seen from the schedule, a lot of work has been done over the year.

    Web


    Mod_parrot was developed for Apache, and any language implementation for Parrot 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 to release Parrot 2.0 and fully compliant with the Perl6 Rakudo specification.

    Read Next