[pypy-dev] rlb.parsing left recursion support ?

Carl Friedrich Bolz cfbolz at gmx.de
Mon May 9 10:20:18 CEST 2011


On 05/08/2011 02:53 PM, Gustavo Kuerten wrote:
> Armin,
>
> My example is not equivalent to the actual test.
> But here is the snippet from test_pypackrat.py
>
>      def test_leftrecursion(self):
>          class parser(PackratParser):
>              """
>              b: b 'a' | 'b';
>              """
>          print parser._code
>          p = parser("b")
>          res = p.b()
>          assert res == "b"
>          p = parser("bac")
>          res = p.b()
>          assert p._pos == 2
>          assert res == "a"
>          p = parser("baaaaaaaaaaaaaac")
>          res = p.b()
>          assert p._pos == 15
>          assert res == "a"
>
> This seems to indicate that it does support left recursion.

There are actually two parser generators in rlib/parsing. This is a test 
for the second, experimental, one. The "official" one does not support 
left recursion. The second one is not stable enough to be used, and I 
guess I should remove it from rlib/ at some point given that I also 
don't plan to continue working on it.

Carl Friedrich



More information about the pypy-dev mailing list