[antlr-interest] could not even do k=1 for decision 126; reason: timed out
Sam Harwell
sharwell at pixelminegames.com
Wed Mar 25 16:10:53 PDT 2009
If you don’t left-factor your rules, it attempts to do so for you. If that process takes longer than the timeout period (default 1 second), it assumes it can’t be done and errors out. Of the two rules below, the former is vastly superior. If you absolutely must use something like the second, at least do this:
multiplicativeExpression
: unaryExpression
( (STAR^ unaryExpression)*
| (DIV^ unaryExpression)*
| (MOD^ unaryExpression)*
)
;
Also, are you sure you didn’t mean this:
multiplicativeExpression
: unaryExpression
( STAR^ unaryExpression
| DIV^ unaryExpression
| MOD^ unaryExpression
)*
;
Sam
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of YINGAnnie
Sent: Wednesday, March 25, 2009 5:58 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] could not even do k=1 for decision 126;reason: timed out
Hi ,
I have another question about grammar:
If I use the following grammar, it works fine.
multiplicativeExpression
: unaryExpression ((STAR|DIV|MOD)^ u=unaryExpression)*
;
But when I change it to
multiplicativeExpression
: unaryExpression (STAR^ unaryExpression)*
| unaryExpression (DIV^ unaryExpression)*
| unaryExpression (MOD^ unaryExpression)*
;
But I got
(10): internal error: org.antlr.tool.Grammar.createLookaheadDFA(Grammar.java:1228): could not even do k=1 for decision 126; reason: timed out (>1000ms)
It seems the two grammar are the same,I dont know why?
Annie
________________________________
把MSN装进手机,更多聊天乐趣等你挖掘! 立刻下载! <http://mobile.msn.com.cn/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090325/7d24d0a4/attachment.html
More information about the antlr-interest
mailing list