> Attempting to come up with a simplistic math grammar that has one possible
> operand (A) and one possible operator (*) - so that things like A, A*A, and
> A*A*A*A*A are all parsed. This simplistic example (thanks to spinclad on
> #perl6) cause PGE to explode.
> 
> $ cat ta.p6r
> grammar f;
> rule atom  { A }
> rule binary { <expr> \* <atom> }
> rule expr { <binary> }

That probably shouldn't die so horribly, but it should die.  We don't
support left-recursive grammars, and this is one.  A
non-left-recursive grammar that matches the same language is:

    grammar f;
    rule atom { A }
    rule binary { <atom> \* <binary> }

Luke

Reply via email to