TITLE ^

P6Grammar - compiler for Perl 6 grammars

SYNOPSIS ^

Command-line:

    parrot P6Grammar.pir [options] file ...

From PIR:

    .local string grammar_source
    .local pmc pgc

    pgc = compreg 'PGE::P6Grammar'

    # Compile grammar_source to PIR
    $P1 = pgc(grammar_source, 'target' => 'PIR')

    # Compile and install grammar_source
    $P1 = pgc(grammar_source)

DESCRIPTION ^

This program takes a set of parser rules (i.e., a parser grammar) specified in the input FILEs, and compiles it into the PIR code needed to execute the grammar. This PIR code is then suitable for inclusion or compilation into other larger programs.

Options ^

--output=OUTFILE

Send the output to OUTFILE. By default, output is directed to the standard output.

--encoding=ENCODING

Encoding to use when reading input files. Defaults to 'ascii', but can also be set to 'iso-8859-1' or 'utf8'.

Functions ^

main(PMC args)

Processes command line arguments, reads input files, dispatches to appropriate PIR-generating subroutines, and then sends the output to the correct output file.


parrot