open encyclopedia * Article Search: * *
*
*

Parrot virtual machine

From open-encyclopedia.com - the free encyclopedia.

Parrot is a register-based virtual machine being developed by the Perl community. It will be the target for the Perl 6 interpreter. Most other virtual machines like the Java virtual machine are stack based. The developers see it as an advantage of the Parrot machine that it has registers, and therefore more closely resembles an actual hardware design, allowing the vast literature on compiler optimization to be used generating code for the Parrot virtual machine.

Contents

License

Parrot is a free software project, distributed under the same terms as Perl, i.e. it is dual-licensed under both the GNU General Public License and the Artistic License.

History

The project started to implement Perl 6 and originally had the very dull name "The software we're writing to run Perl 6". The name Parrot came from an April Fool's joke in which a hypothetical language named Parrot was announced that would unify Python and Perl. Later, the name was adopted by this project whose intent is to do just that. Several tiny languages are developed along with it which target the parrot virtual machine.

Parrot 0.1.0 "Leaping Kakapo" was released on February 20, 2004. Parrot 0.1.1 "Poicephalus" was released on October 9, 2004.

Internals

Internal languages

The Parrot virtual machine uses PASM, Parrot assembly language., and PIR, Parrot's Intermediate Representation (also known as IMCC, named after the compiler, InterMediate Code Compiler, for it).

Examples

Registers

Unlike most virtual machines (which are stack-based), Parrot is register-based, just like most hardware CPUs. It provides four types of 32 registers each:

  • I0-I31: native integer type
  • N0-N31: floating point numbers
  • S0-S31: advanced string registers with Unicode support
  • P0-P31: PMC, or Parrot Magic Cookie — Parrot object type

Arithmetic operations

   set I1, 10
   inc I1        # I1 is now 11
   add I1, 2     # I1 is now 13
   set N1, 42.0
   dec N1        # N1 is now 41.0
   sub N1, 2.0   # N1 is now 39.0
   print I1
   print ", "
   print N1
   print "\n"
   end


Culture

Tagline

The current tagline of the Parrot project is "one bytecode to rule them all," a reference to Tolkien's One Ring from The Hobbit & Lord of the Rings stories.

External links

Articles at parrotcode.org
Articles at sidhe.org

de:Parrot fr:Parrot pl:Parrot

Contribute Found an omission? You can freely contribute to this Wikipedia article. Edit Article
Copyright © 2003-2004 Zeeshan Muhammad. All rights reserved. Legal notices. Part of the New Frontier Information Network.