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

Jim Idle jimi at temporal-wave.com
Tue Feb 5 08:36:14 PST 2008



> -----Original Message-----
> From: Erik Kratochvil [mailto:discontinuum at gmail.com]
> Sent: Tuesday, February 05, 2008 2:57 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Grammar.createLookaheadDFA(): could not even
> do k=1 for decision 45;
> 
> Hi.
> 
> I have a parser grammar which would not be processed neither by
> antlr-3.0.1 (official release) nor by antlr-3.1b1
> (antlr-2008-01-23.10.tar.gz).
> 
> antlr-3.0.1 fails with:
> 
> error(10):  internal error:
> org.antlr.tool.Grammar.createLookaheadDFA(Grammar.java:864): could not
> even do k=1 for decision 442
> 
> antlr-3.1b1 fails with a little bit more descriptive error:
> 
> error(10):  internal error:
> org.antlr.tool.Grammar.createLookaheadDFA(Grammar.java:1138): could
> not even do k=1 for decision 442; reason: timed out (>1000ms)

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.

Jim



More information about the antlr-interest mailing list