The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

perl6 - perl6 driver program

SYNOPSIS

perl6 [ p6c-options ] [ imcc-options ] [ asm-options ] [ run-options ] [ global-options ] file ...

perl6 --clean *.p6

perl6 --test [testfiles...]

DESCRIPTION

perl6 calls all the appropriate stages to parse, assemble and run a perl6 source file. As these steps evolve this program will, or it will be garbage collected sometime in the future.

If called with .imc, .pasm or .pbc files, the appropriate pass(es) will be run.

OPTIONS

p6c-options

These options are for the parser P6C and for output generation.

Output options

-C|--compile-pbc

Compile to executable and run native. See also Run options below.

-B|--pbc

Stop after creating .pbc file.

-I|--imc

Stop after creating .imc file.

--tree

Stop after creating parse tree, do not generate .imc output.

--raw-tree

Output raw parser tree, additionally to parse tree.

--keep-imc --keep-pbc --keep-c --keep-o --keep-warn --keep-exe

Keep intermediate file.ext. If perl6 stops with an error or with above options, temp files are always kept. The last output step (.pmc or executable) is of course kept.

-k|--keep-all

Keep all intermediate files.

--clean

Unlink all files perl6 might have generated (see FILES below), except those to --keep, e.g.

        perl6 file.p6 --clean --keep-exe
--test

Run tests like "make test". As the program startup and parser generation are done only once, with this option tests run much faster.

--test-parser

Interactive parser-testing mode. The parser enters an interactive mode. An empty line sends input to the parser.

-g|--debug-info

Generate debug info. This adds #line n "file" and source comments to the .imc file.

Parse::RecDescent control

--trace

Set $::RD_TRACE. You know what it is when you want this.

--hitem

Keep track of %item hash. (only useful when constructing parser)

--force-grammar

Rebuild grammar even if it exists.

--grammar NAME

Use precompiled grammar NAME (default = Perl6grammar)

Misc

--rule NAME

Start with rule NAME (default = 'prog') (only useful in interactive mode)

imcc-options

--debug

Write various debug messages to STDERR.

--yydebug

Show bison's debug output

asm-options

-E

Preprocess input files and terminate processing.

-h|--help

Print this message.

-o|--output F

Write output to file F.

-c|--checksyntax

Check syntax only, do not generate bytecode.

run-options

-q|--quick

Run the .pbc file directly if it does exist and is not older then the .p6 source file.

-R..|--parrot-options=bdhjpPgtv.

pass option(s) to parrot, see parrot -h.

    e.g. "perl6 -Rb. ..."  calls "parrot -b -. ..."
--shared

Run against shared dynamic libparrot - you must currently build it manually in parrot root with:

        cd ../..
        make libparrot.a        # static lib
        make shared             # dynamic lib
        cd -                    # back to perl6
        # and set this LD_LIBRARY_PATH
        # as libparrot.so is not installed during testing
        #
        export LD_LIBRARY_PATH=../../blib/lib
--ignore-exitcode

Don't report non zero exit codes. This is needed e.g. for make test, when native code is tested.

--rm-exe

Remove executables after running. This is useful for testnative.

global-options

-h|--help

Print this message and exit

-v|--verbose

Print mesages about compile stages

-vv

Be more verbose, print intermediate stages.

-V|--version

Print versions to STDOUT and exit

-w|--warnings

Print warnings. If »-w« is off, warnings are collected in file.warn.

-ww

Print diagnostics. N/Y.

RETURN VALUE

Zero means successful compilation/run.

EXAMPLES

perl6 foo.pl

Parse, assemble and run »foo.pl«, warnings and errors will go to »foo.warn«. Intermediate files are »foo.*«, s. FILES below.

echo 'my $a=2; print $a _ "\n"' | perl6 -vvw

Show individual steps, display warning, intermediate files are named »a.*«.

perl6 mops.pasm

Assemble and run mops.pasm.

ENVIRONMENT

As perl6 is written in perl5, see perldoc perlrun. No environment vars are used currently.

FILES

Perl6 process the following files:

        file.p6 ... perl6 source
        file.imc ... intermediate compiler code
        file.pasm ... parrot assember code
        file.pbc ... parrot byte code

The following files may be generated too:

        file.warn ... various warnings and errors during all stages
        file.tree ... parser tree (--tree)
        file.c
        file.o
        file     ...  with option -C or
        file.exe      depending on $^O

        file.out  ... perl6 --test result file
        file.test ... perl6 --test Test::Harness input

Additionally the following files are cleaned by --clean

        file.trace      $ ../../parrot -t file.pbc 2> file.trace
        file.diss       $ ../../disassemble file.pbc > file.diss

If STDIN in processed, the filebase "a" will be used.

SEE ALSO

Have a look at the individual stages:

        P6C  ... perl6 parser, imc generator

        imcc ... intermediate code compiler, which is really:

        parrot ... byte code interpreter

BUGS

Parrot::Config doesn't provide all info needed to run, so there are some hard coded values at the beginning of the program.

When a intermediate stage dumps core, the message is not in file.warn.

TODO

- clean up the option handling, parrot hash long options now - Check for core files, and optionally get backtrace - clean up source file - more use of Parrot::Config - filter warnings/diagnostics ... -Wofile -W/frompat/../topat/ (grep expr)

AUTHOR

Leopold Tötsch <lt@toetsch.at>

With a lot of help Sean O'Rourke and parts from his prd-perl6.pl.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 961:

Non-ASCII character seen before =encoding in '»-w«'. Assuming CP1252