To get an idea how perl6 parses your code, you can use the --target
option:
$ perl6 --target=parse -e '"Hello World".say'
- statementlist: "Hello World".say
- statement: 1 matches
- EXPR: .say
- 0: "Hello World"
- value: "Hello World"
- quote: "Hello World"
- nibble: Hello World
- OPER: .say
- sym: .
- dottyop: say
- methodop: say
- longname: say
- name: say
- identifier: say
- O: <object>
- dotty: .say
- sym: .
- dottyop: say
- methodop: say
- longname: say
- name: say
- identifier: say
- O: <object>
$
Far better is the Grammar::Tracer
module described here. According to the module documentation, one simply adds use Grammar::Tracer
and any grammar defined in the scope where the use statement appears will be traced.
My question is simply this: If I'm using a "star release", what's the easiest way to get tracing (using Grammar::Tracer) on the Perl6 Grammar itself?
Alternatively, if I'm using rakudobrew, what's the easiest way to get tracing on the Perl6 Grammar itself?
It's recommended that perl6 users use star releases - would a desire to examine more closely how perl6 parses itself, using Grammar::Tracer, be worth building from source locally instead?