Dual-license your content for inclusion in The Perl 5 Wiki using this HOWTO, or join us for a chat on irc.freenode.net#PerlNet.

Parrot

From PerlNet

Jump to: navigation, search

This article is a stub. It is requested that it be improved and expanded. You can help PerlNet by expanding it. Once it has been improved, this message should be removed.

Parrot Languages

Parrot accepts input as Parrot Abstract Syntax Tree (PAST), Parrot Intermediate Representation (PIR) and Parrot Assembly (PASM). All of these can be generated by compilers that target the Parrot Virtual Machine. Of these, PAST and PIR are human readable. PIR hides away low-level details like function calling conventions whereas PASM doesn't.

You could for example write the typical "Hello, World!" example in PIR:


  .sub _main
     print "Hello world!\n"
     end
  .end


You could then turn that into PASM:

  parrot -o helloworld.pasm helloworld.pir

The result is:

  _main:
      print "Hello world!\n"
      end

You can run either the PIR or PASM code with parrot with

  parrot helloworld.pir

or

  parrot helloworld.pasm

and you get

  Hello world!

as expected.

Personal tools