On Sunday 06 September 2009 10:40:44 Shlomi Fish wrote: > Hi all! > > Which parser generator do you recommend to use for a Perl project. What > I've looked at so far: > > 1. Berkeley Yacc for Perl - works pretty well, but is kinda limited.
Can't say i've used it before, but if its really Yacc then i believe that Parse::Yapp does a better job of having a perl yacc. > 2. Parse::RecDescent - very impressive feature set, but a little slow, and > has been under-maintained (though it seemed to have improved slightly with > several new releases in 2009). It also tends to be hard to debug its > errors. I've mostly had issues with either speed or getting precedence right with Parse::RecDescent > 3. Parse::Yapp - http://search.cpan.org/dist/Parse-Yapp/ - I tried to use > it in https://svn.berlios.de/svnroot/repos/web-cpan/Text-Qantor/ but it > gives me an error for what appears to be a valid syntax, and for the life > of me I cannot understand why it is. there's an ambiguity there in your grammar, i've run into that many times with Math::Farnsworth yapp -v will make a file.output that describes everything in the grammar and can easily help with the debugging of things, the warnings about useless and unused terminals are harmless (though could mean you've got a typo). useless rules just means that they're in there but can't be reached, its sort of like if (something that is always true) { do something here } else { die "true != true"; } your shift reduce conflict is in the rule plain_para_text: TEXT | plain_para_text TEXT { my $t1 = $_[1] ; my $t2 = $_[2] ; [$t1->[0].$t2- >[0], $t1->[1]] } ; its happening because it can recurse infinitely on itself and then see the TEXT rule, (it'd also be expecting a second TEXT after that) i'm not 100% sure what you were trying to do there, but the following rule does what i THINK you were intending plain_para_text: TEXT { my $t1 = $_[1] ; my $t2 = $_[2] ; [$t1->[0].$t2->[0], $t1->[1]] }; as far as bison and ANTLR go i've never used either of them so i won't comment, and i've got no idea about using PGE with perl so... There's also Parse::Earley out there i played with that a bit but not as much as i have with RecDescent and Yapp P.S. sorry if this got sent twice, i found an oddity in my smtp settings and don't think anything was ever making it out.