Programming PIR: Build applications in Parrot’s native programming language
Parrot is not just a virtual machine for running dynamic languages; it also includes several tools for building dynamic languages, including a grammars engine and a tree transformation system. Currently, all of these tools are available through PIR, Parrot’s native programming language.
Parrot is not just a virtual machine for running dynamic languages; it also includes several tools for building dynamic languages, including a grammars engine and a tree transformation system. Currently, all of these tools are available through PIR, Parrot’s native programming language. PIR is an assembly language that more or less resembles the actual operations the virtual machine performs when it executes a program. It’s possible to represent every program written in a high-level language hosted on Parrot as a PIR program. You just don’t always want to.
(Actually, Parrot bytecode — the actual instructions Parrot executes — itself is a binary form of an even lower language called PASM, or Parrot Assembly. PIR stands for Parrot Intermediate Representation. You can program directly in PASM if you like, but PIR has a few additional syntactic elements that make it much more pleasant, including a simpler syntax for function calls and parameters, in particular. You can safely ignore the existence of PASM quite happily.)
The PIR layer is also the point at which most language interoperability will occur. That is, because all code running on Parrot is Parrot bytecode, calling a Perl 6 function from a Cardinal (Ruby on Parrot) program that returns an object written in pure PIR should look to Parrot as if all three languages were PIR. (The semantics of native types in each language may differ, and rightfully so, but language interoperability should never change the semantics of data that moves across language barriers.)
In any…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: