Just for the hell of it, I wrote the following to help me keep track of the rules that have been used, and whether or not they have an associated rule or token block.
Feel free to use for your own projects;
use v6.c;
# Replace with name of your own file, here.
my $script = "DDLGrammar.pm6".IO.open.slurp-rest;
my @used_rules = $script ~~ m:g/ '<' ( <[ _ \w ]>+ ) '>'/;
my @defined_rules = $script ~~ m:g/ [ 'token' || 'rule' ] \s+ ( \w+ ) \s+ '{'/;
@used_rules = @used_rules.map( *[0].Str ).unique.sort;
@defined_rules = @defined_rules.map( *[0].Str ).sort;
#say "USED\n----\n{ @used_rules.join("\n") }\n";
#say "DEF\n---\n{ @defined_rules.join("\n") }";
for @used_rules {
say "$_ not defined" if @defined_rules.none eq $_;
}