[antlr-interest] Grammar.createLookaheadDFA(): could not even do k=1 for decision 45;

Erik Kratochvil discontinuum at gmail.com
Wed Feb 6 00:25:34 PST 2008


On 2/5/08, Jim Idle <jimi at temporal-wave.com> wrote:
>
> It means that your grammar is extremely ambiguous and the analysis of
> that particular decision has timed out (1000ms is the default). You
> could try to increase this timeout (see the wiki for the option), but it
> is likely to just take longer to time out I am afraid.
>
> You could try backtracking (but this is quite a performance overhead, so
> you should only really do it for prototyping or where you dont really
> care about performance), or try using k=1 options in some of the
> subrules and so on. However, your best bet is to step back in time with
> your grammar and find out what you introduced to make it exhibit this
> behavior, then re-specify the grammar in a less ambiguous fashion.
>

Aha. The problem is that the grammar is not mine, I sort of inherited
it. It was written for antlr 2.7 (and it worked well) and my task was
to convert it so that it works with antlr 3. It is true that the
grammar has some ambiguity issues, there are more than three dozens of
syntactic and semantic predicates and the generated parser.java has
more than 100MB while the size of the parser generated by antlr2.7 was
only 2.3MB. I guess that conversion from 2.7 to 3.0 is not as easy as
I thought :)

Thank you very much, I shall do as you suggest - I'll try to rewrite
the problematic rules.

-- 
Erik Kratochvíl


More information about the antlr-interest mailing list