On 8/3/10 2:14 PM, Lukas Renggli wrote:
Hi Alberto,
This is great news. Maybe you also want to post the repository URL? :-)
Sure, please don't be too much horrified by the quality of the code:
http://www.squeaksource.com/PetitJava.html
For what you noticed on bogus grammar specifications
check out the
work of Vadim Zaytsev (
http://mobile.twitter.com/grammarware). Among
others he analized various Java Language Specifications.
That's interesting, thank you!
Note that cycles are present in most grammars and
perfecly fine. The
only problematic cycles are the left-recursive ones for recursive
descent parsers like ANTLR or PetitParser. Even then you can simply
fix the problem by adding a memoizer into the offending cycle, but
that yields a very slow grammar. You can find offending cycles with
the message #cycleSets from the PetitAnalyzer package.
I tried using the "cycle" tab in the PetitParser GUI, which -I think-
does the same thing. Knowing how to call it programmatically is even
better ;)
Alberto