Skip Menu |
Report information
Id: 132004
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: daxim <daxim [at]>

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: infinite loop with grammar
Download (untitled) / with headers
text/plain 1.2k
› perl6 -v This is Rakudo version 2017.07 built on MoarVM version 2017.07 implementing Perl 6.c. › cat use v6; grammar Flail { rule TOP { <B> } rule B { <A> 'x' 'y' | <C> } rule A { '' | 'x' 'z' } rule C { <C> 'w' | 'v' } } Flail.parse('x z x y').say; Flail.parse('v w w w w w w').say; › perl6 「x z x y」 B => 「x z x y」 A => 「x z 」 ^C The execution simply goes into infinite loop with the second input. This is the least awesome failure mode. Compare with Pegex and Regexp::Grammars, which emit a recursion warning/error. Compare with Antlr4, where the grammar is effectively a compile time error. Compare with Eyapp and Marpa, which can consume this grammar and set of inputs without any problem. I realise that the parser cannot be simply changed since it also parses Perl6 source code. But since it is now shown that the parser is not a general parser able to consume arbitrary valid CFG, then at least the documentation must mention somewhere * what the name/classification of the underlying technology/algorithm of the parser is and * what its shortcomings are (with examples) so that a user can make an informed decision.
Download (untitled) / with headers
text/plain 119b
Shorter example: grammar Flail { token TOP { <TOP> 'w' | 'v' } } Flail.subparse('vwwwwww').say;

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at