How can error reporting in grammars be improved?
Is there a way to get Perl 6 to generate an error message if a grammar does not match? Or at least return the position of the last data it processed? It is quite hard to fix syntax errors if all I get from the parser is 'no match'. If your focus is generating messages for users of your grammar, see Generating Good Parse Errors from a Parser and Grammar::ErrorReporting . The rest of this answer is about debugging. First, you can embed arbitrary closures (code) in Perl 6 rules (or tokens or regexes). Just type { your code goes here } in the middle of a rule. So you could just sprinkle { say ...