# New Ticket Created by  Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 
# Please include the string:  [perl #132004]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=132004 >


    › perl6 -v
    This is Rakudo version 2017.07 built on MoarVM version 2017.07
    implementing Perl 6.c.

    › cat flail.pl
    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 flail.pl
    「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.

Reply via email to