O'Reilly logo

Perl 6 Essentials by Leopold Tötsch, Dan Sugalski, Allison Randal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Parrot Assembly Language

Owner: Sorry squire, I’ve had a look ‘round the back of the shop, and uh, we’re right out of parrots.

Customer: I see. I see, I get the picture.

Owner: <pause> I got a slug.

Monty Python’s Flying Circus, “Parrot Sketch”

Parrot assembly (PASM) is an assembly language written for Parrot’s virtual CPU. PASM has an interesting mix of features. Because it’s an assembly language, it has many low-level features, such as flow control based on branches and jumps, and direct manipulation of values on the software registers and stacks. Basic register operations or branches are generally a single CPU instruction.[32] On the other hand, because it’s designed to implement dynamic high-level languages, it has support for many advanced features, such as lexical and global variables, objects, garbage collection, continuations, coroutines, and much more.

Getting Started

The first step before you start playing with PASM code is to get a copy of the source code and compile it. There is some information on this in Section 2.2.2.1. For more information and updates, see http://www.parrotcode.org and the documentation in the distributed code.

The basic steps are:[33]

$ perl Configure.pl
$ make
$ make test

With versions of Parrot later than 0.0.10, you can speed up the testing process significantly by compiling IMCC first (see Section 7.1) and running the tests with IMCC instead of the Parrot assembler:

$ make test IMCC=languages/imcc/imcc

Once you’ve compiled Parrot, create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required