Parrot_virtual_machine Parrot_virtual_machine

Parrot virtual machine - Definition and Overview

Related Words: Basic, Covert, Cryptic, Esoteric, Essential, Fundamental, Latent, Lurking, Mystic, Occult, Possible, Potential, Sleeping, Underlying

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.

An increasing number of languages can be compiled to Parrot assembly language. Besides a subset of the planned Perl 6, these include BASIC, Befunge, Brainfuck, Cola, Forth, Jako, m4, Miniperl, Ook, Parakeet, OpenComal, PHP, Plot, Python, Ruby, Scheme, Tcl, URM, and YAL. Most of these other language implementations are currently still experimental.

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 [1] (http://www.oreilly.com/news/parrotstory_0401.html). 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.

The Parrot source code was first released to the world on September 10, 2001. 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

Parrot code has three forms. Bytecode is natively interpreted by Parrot. PASM (Parrot assembly language) is the low level language that compiles down to bytecode. PIR (Parrot Intermediate Representation) is a slightly higher level language than PASM and the primary target of language implementations. PIR transparently manage Parrot's inter-routine calling conventions, provides improved syntax, register allocation, register spilling, and more.

IMCC is the InterMediate Code Compiler for Parrot and compiles PIR (which is also known as IMC and is usually stored in files having the suffix ".imc").

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.

See also

External links

Articles at parrotcode.org
Articles at sidhe.org

Example Usage of virtual

cafehandmade: From Israel To You rejoins our virtual Craft Show. The best artisans that Israel has to offer.http://bit.ly/8RdEOf
tecoteco_bonner: Seu um dia eu deixar que algo do meu mundo virtual atrapalhe meu mundo real. deixarei de ser real....KKKKK Sou fã da Marta... @guardawbonner
reconhecimento: Pós Graduação virtual UDF. Ganhe tempo e qualidade de ensino. www.udf.edu.br
Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.