Ply(LALR) and Yacc behaving differently
Åsmund Grammeltvedt
asmundg at stud.cs.uit.no
Fri Apr 8 17:55:44 EDT 2005
On Fri, 8 Apr 2005, Carsten Haese wrote:
> On Thu, 2005-04-07 at 14:51, Åsmund Grammeltvedt wrote:
> > Hi.
> >
> > I am trying to implement a small compiler in python and, trying to use
> > something a bit more pythonic than lex/yacc, ended up with ply
> > (http://systems.cs.uchicago.edu/ply/). The only problem is that whereas
> > yacc accepts the grammar and appears to parse it correctly, ply does not.
> Maybe this is a PLY bug? LALR(1) support appears to be a relatively
> recent addition to PLY. Have you tried contacting PLY's author?
>
> For what it's worth, it appears that you can make your example grammar
> work in LALR-mode PLY by eliminating the empty production and making the
> Block rule right recursive like this:
> Of course, I don't know whether this rewrite is applicable to your
> larger grammar.
Unfortunately, it is not. Fortunately, I tried PyBison as a replacement
and everything worked perfectly. So I suspect, as you said, that this is a
bug with PLY's LALR(1) implementation.
Thanks for the help.
--
Åsmund Grammeltvedt
Are you infringing, citizen? | webshop.ffii.org/
More information about the Python-list
mailing list