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.
parrot [options] file [arguments]
The file is either an .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.
- -a, --pasm Assume PASM input on
- -c,--pbc Assume PBC file on
- -d,--debug [hexbits] Turn on debugging output. The
- --help-debug Show debug option bits.
- -h,--help Print a short summary of options to
- -o outputfile Act like an assembler. With this switch Parrot won't run code unless it's combined with the
- -r,--run-pbc Immediately execute bytecode. This is the default unless
- -v,--verbose One
- -y,--yydebug Turn on
- -E,--pre-process-only Show output of macro expansions and quit.
- -V,--version Print the program version to
- -Ox Turn on optimizations. The flags currently implemented are shown in Table 11-4.
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. 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
-dswitch 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
-dswitch by whitespace, it has to start with a number. To produce a huge output on
stderr, turn on all the debugging bits:
$ parrot -d 0ffff ...
-rswitch. If the name of outputfile ends with a .pbc extension, Parrot writes a Parrot bytecode file. If outputfile ends with a .pasm extension, Parrot writes a PASM source file, even if the input file was also PASM. This can be handy to check various optimizations when you run Parrot with the
-ois present. The combination of
output.pbcwrites a bytecode file and executes the generated PBC.
-v) shows which files are worked on and prints a summary of register usage and optimization statistics. Two
-v) also prints a line for each individual processing step.
The interpreter options are mainly for selecting which run-time core to use for interpreting bytecode. The current default is the computed goto core if it's available. Otherwise the fast core is used.
- -R slow Run with the slow core
- -R bounds Activate bounds checking. This also runs with the slow core as a side effect.
- -R fast Run with the fast core.
- -R gcdebug Performs a full GC run before every op dispatch (good for debugging GC problems)
- -p,--profile Activate profiling. This prints a summary of opcode usage and execution times after the program stops. It also runs within the slow core.
- -t,--trace Trace execution. This also turns on the slow core.
- -w,--warnings Turn on warnings.
- -G,--no-gc Turn off GC. This is for debugging only.
- -.,--wait Wait for a keypress before running.
- --leak-test,--destroy-at-end Cleanup up allocated memory when the final interpreter is destroyed.
Parrotdestroys created interpreters (e.g. threads) on exit but doesn't normally free all memory for the last terminating interpreter, since the operating system will do this anyway. This can create false positives when
Parrotis run with a memory leak detector. To prevent this, use this option.