For those who have been following along, I've just checked in
some changes (r12488) that cause the compilation sequence to
more closely follow the expected plan -- i.e.:
source -> parse tree -> PAST -> POST -> PIR -> bytecode -> execution
The PAST and POST representations are currently held in
lib/PAST.pir and lib/POST.pir . Unfortunately, these aren't
exactly the same as what punie/pheme have been using for their
PAST and POST representations (currently in compilers/past/ and
compilers/post), but they're very close, and Allison, chromatic, and
I are working to come to a common framework fairly soon.
The command for executing the compiler is basically:
$ parrot perl6.pbc source.p6
which compiles and executes the statements in the 'source.p6' file.
If the source file is omitted, then statements are read from the
standard input and executed immediately.
There is also a --target option available which can display the
results after various phases of compilation:
$ parrot perl6.pbc --target=parse # show parse tree
$ parrot perl6.pbc --target=PAST # show PAST
$ parrot perl6.pbc --target=POST # show POST
$ parrot perl6.pbc --target=PIR # show PIR
Right now we're in the process of building towards executing as
much of the Pugs test suite as we can, which will undoubtedly take
a little time. The initial target is to get things "working", and
deal with optimization issues a bit later.
The key files for parsing Perl 6 are in lib/grammar_rules.pg and
lib/grammar_optok.pg. The "grammar_rules" file describes the top-down
rules used to parse programs -- generally things that aren't expressions.
The "grammar_optok" file defines the tokens for the operator-precedence
parser for bottom-up parsing of expressions. Although these two files
are using a very Perl 6-like syntax for specifying the rules and operator
tokens, it's not intended that these be able to accommodate arbitrary
Perl 6, or that the grammar can assume a working Perl 6 implementation
beneath it. (In fact, Audrey and others are working on a "minimal Perl"
syntax that may be considered available from any regex engine.)
The README file in languages/perl6/README has more details of the
design, and further details will be posted to perl6-compiler in
the days and weeks ahead. The STATUS file tends to identify the
areas of focus at any given time.