Team LiB   Previous Section   Next Section

6.1 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:[2]

[2] Not all operating systems have make. Check the documentation for instructions for systems that aren't Unix-based.

$ 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 a small test file in the main parrot directory. We'll call it fjord.pasm.

print "He's pining for the fjords.\n"

end

.pasm is the standard extension for Parrot assembly language source files. Compile it to bytecode, using assemble.pl:

$ ./assemble.pl fjord.pasm --output fjord.pbc

You specify the name of the output bytecode file with the --output (or -o) switch. .pbc is the standard extension for Parrot bytecode. Finally, run the compiled bytecode file through the parrot interpreter:

$ ./parrot fjord.pbc

That's all there is to it.[3]

[3] Though you may want to look ahead to Section 7.1 for a one-step way to run PASM code.

If you're anything like me, the next thing you're going to do is symlink parrot from a directory in your PATH, and write a tiny script for the assembler so that from any directory you can just type:

$ assemble fjord.pasm

$ parrot fjord.pbc

These last steps are optional. In fact, something similar may be done for you with a make install target by the time you read this.

    Team LiB   Previous Section   Next Section