Parrot Command-Line Options

Since Parrot is both an assembler and a bytecode interpreter, it has options to control both behaviors. Some options may have changed by the time you read this, especially options related to debugging and optimization. The document imcc/docs/running.pod should have the latest details. Or just run parrot —help.

General Usage

parrot [options] file [arguments]

The file is either an .imc (.pir) or .pasm source file or a Parrot bytecode file. Parrot creates an Array object to hold the command-line arguments and stores it in P5 on program start.

Assembler Options

-a, --pasm

Assume PASM input on stdin. When Parrot runs a source file with a .pasm extension, it parses the file as pure PASM code. This switch turns on PASM parsing (instead of the default PIR parsing) when a source file is read from stdin.

-c,--pbc

Assume PBC file on stdin. When Parrot runs a bytecode file with a .pbc extension, it immediately executes the file. This option tells Parrot to immediately execute a bytecode file piped in on stdin.

-d,--debug [hexbits]

Turn on debugging output. The -d switch takes an optional argument, which is a hex value of debug bits. (The individual bits are shown in Table 11-3.) When hexbits isn’t specified, the default debugging level is 0001. If hexbits is separated from the -d switch by whitespace, it has to start with a number.

Table 11-3. Debug bits

Description

Debug bit

DEBUG_PARROT

0001

DEBUG_LEXER

0002

DEBUG_PARSER

0004

DEBUG_IMC

0008

DEBUG_CFG

0010 ...

Get Perl 6 and Parrot Essentials, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.