Running Parrot code
This file briefly describes the current set of executables and what they're for.
assemble.pl
-
Converts a Parrot Assembly file to Parrot bytecode.
perl assemble.pl foo.pasm > foo.pbc
Usage information:
assemble.pl -h
. Detailed documentation on the underlying module can be read withperldoc -F lib/Parrot/Assembler.pm
. parrot
-
Interprets a Parrot bytecode file.
parrot foo.pbc
parrot
has two alternate modes of operation: prederef mode (parrot -P
) and jit mode (parrot -j
).Jit mode works for any program that doesn't use the stack ops. That's because we use fixed address for registers, this problem will be solved soon.
Prederef mode only works as a shared library. For example, on most Unix platforms:
make clean make shared LD_LIBRARY_PATH=blib/lib ./parrot -P foo.pbc
You will not be able to use any of the automatic testing targets after running
make shared
.parrot
also has several debugging and tracing flags; see the usage description (generated byparrot -h
) for details. optimizer.pl
-
Performs some basic optimizations on Parrot assembly files. Use it by running
perl optimizer.pl foo.pasm
This will generate a foo.pasm.opt file containing the optimized version.
pbc2c.pl
-
Converts a bytecode file to a native .c file.
perl pbc2c.pl foo.pbc > foo.c
For more information, type
perldoc -F pbc2c.pl
.To convert the generated foo.c file to a binary, do (on Unix only):
make libparrot.a gcc -O3 -g -Iinclude -c foo.c -o foo.o gcc -g -o foo foo.o -L. -lparrot -ldl ./foo # Runs it
- make test
-
make test
will compile anything that needs to be compiled and run all standard regression tests. To look at a test more closely, run the appropriate test file in the t/ directory:perl -Ilib t/op/basic.t
To keep a copy of all of the test
.pasm
and.pbc
files generated, set the environment variable POSTMORTEM to 1:POSTMORTEM=1 perl -Ilib t/op/basic.t ls t/op/basic*
To run tests with a different dispatcher, edit
$Parrot::Config::PConfig{test_prog}
in lib/Parrot/Config.pm:'test_prog' => 'parrot -P',
and then use any of the above methods for running tests.