[antlr-interest] Why is ANTLR getting lost?

Jon Schewe jpschewe at mtu.net
Wed Feb 20 08:56:44 PST 2008


Ok that worked for one case, however it hasn't worked for another case
that is valid.  I put the options {k=4; } in the rule and I still see a
DFA being constructed and predict called on it.

Fred wrote:
> If I'm not mistaken this is a know bug in 3.0.1
> You can work around it by using LL(k) rather than LL(*) thereby
> suppressing the construction of the DFA.
> This can be done by adding...
>  options { k=4 }
> ...to the offending rule.
>
> peace
>
>   
>> Date: Wed, 20 Feb 2008 06:32:46 -0600
>> From: Jon Schewe <jpschewe at mtu.net>
>> Subject: Re: [antlr-interest] Why is ANTLR getting lost?
>> To: antlr-interest <antlr-interest at antlr.org>
>> Message-ID: <47BC1DEE.6050005 at mtu.net>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> I've figured out that ANTLR is dying in the DFA when it's trying to
>> determine which branch of the constraintDecl rule to follow.  Attached
>> is the grammar, suggestions on how to resolve this are very welcome.
>>
>> Test case is here:
>>   /**
>>    * @throws RecognitionException
>>    */
>>   @Test
>>   public void testConstraintDecl0() throws RecognitionException {
>>     final String data = "constraint3: 5.0 <= 6 + 6 * a[1 + 3] * c - 1 <=
>> 10.0;";
>>
>>     final GHOCESLexer lexer = new GHOCESLexer(new ANTLRStringStream(data));
>>     final CommonTokenStream tokens = new CommonTokenStream(lexer);
>>     final GHOCESParser parser = new GHOCESParser(tokens);
>>     final GHOCESParser.constraintDecl_return r = parser.constraintDecl();
>>     Assert.assertNotNull(r);
>>   }
>>     

-- 
Jon Schewe | http://mtu.net/~jpschewe
If you see an attachment named signature.asc, this is my digital
signature.
See http://www.gnupg.org for more information.

For I am convinced that neither death nor life, neither angels 
nor demons, neither the present nor the future, nor any 
powers, neither height nor depth, nor anything else in all 
creation, will be able to separate us from the love of God that 
is in Christ Jesus our Lord. - Romans 8:38-39



More information about the antlr-interest mailing list