Getting Started

Benabik edited this page Jan 17, 2012 · 3 revisions

The easiest way to start using Parrot is to install one of the available pre-compiled binaries. Packages are available for many packaging systems including Debian, Ubuntu, Fedora, Mandriva, FreeBSD, Cygwin, and MacPorts. The Parrot website lists all known packages on the download page. A binary installer for Windows is also available at http://sourceforge.net/projects/parrotwin32/.

If packages aren't available on your system or you'd just rather install Parrot from scratch, download the latest supported release from http://www.parrot.org/release/supported.

You need a C compiler and a make utility to build Parrot from source code. gcc and make are the most commonly used tools but Parrot can be built with many other compilers on different operating systems. Perl 5.8.0 is also required for configuring and building Parrot.

Once you have all the required dependencies installed, build Parrot by running:

$ perl Configure.pl
$ make
$ make test

By default, Parrot installs to the /usr/local/bin and /usr/local/lib directories. If you have write permissions for these directories, install Parrot with:

$ make install

To install Parrot beneath a different prefix, provide the --prefix switch to Configure.pl:

$ perl Configure.pl --prefix=/some/other/directory

If you intend to develop a language on Parrot, install the necessary developer tools with:

$ make install-dev

Running Parrot

Once you've installed Parrot, take it for a test drive. Create a file called hello.pir. .pir files contain Parrot Intermediate Representation (PIR) instructions or opcodes; Parrot's native low-level language that has some high-level features.

# hello.pir
say "Hello world!"

Now run this file with:

$ parrot hello.pir

which will print:

Hello world!

Running a Language on Parrot

Next, try out one of Parrot's high-level languages: Not Quite Perl 6 (NQP). Create a file called news.nqp:

# news.nqp
say("No parrots were involved in an accident on the M1 today...");

Then run it as:

$ parrot-nqp news.nqp

which will print:

No parrots were involved in an accident on the M1 today...

For information on other languages available on Parrot, see the Languages page.