[antlr-interest] bugs

Terence Parr parrt at cs.usfca.edu
Thu Oct 27 09:55:43 PDT 2011


* Dieter Habelitz reported bug in java code gen with synpreds. labels were
  being carried from grammar into synpreds but weren't typed properly (they
  were "void x=null;" for x=ruleref labels)

Fixed. pushed. grab at http://antlr.org/depot/antlr3/main/tool/target/

please let me know if it works.

Ter
On Oct 24, 2011, at 7:49 AM, Terence Parr wrote:

> 
> 
> Begin forwarded message:
> 
>> From: Dieter Habelitz 
>> Subject: [antlr-interest] ANTLR v3.4 generates compiler errors (that v3.3 doesn't generate)
>> Date: October 24, 2011 7:41:31 AM PDT
>> To: antlr-interest at antlr.org
>> 
>> Hi folks,
>> 
>> When feeding ANTLR 3.4 with my Java grammars it doesn't generate valid 
>> Java sources (26 compiler errors) - with v3.3 everything is okay.
>> 
>> Here's a snipped of the grammar that raises one of the problems:
>> 
>> statement
>>   :   block
>>   |   assertStatement
>>   |   ifStatement   
>>   |   forStatement
>>   |	[... and so on ...]
>>   ;           
>> 
>> ifStatement
>> 	: IF parenthesizedExpression ifStat=statement 
>>       (   ELSE elseStat=statement -> ^(IF parenthesizedExpression $ifStat $elseStat)
>>       |                           -> ^(IF parenthesizedExpression $ifStat)
>>       )
>> 	;
>> 
>> Amongst other things v3.4 generates the following code for the 'ELSE' branch
>> of the rule 'ifStatement' (have a look at the local 'variable 
>> declaration': void  =null;):
>> 
>>   public final void synpred137_Java_fragment() throws RecognitionException {
>>       void  =null;
>> 
>>       // [... some comments not relevant here ...]
>>       {
>>       match(input,ELSE,FOLLOW_ELSE_in_synpred137_Java9244); if (state.failed) return ;
>> 
>>       pushFollow(FOLLOW_statement_in_synpred137_Java9248);
>>       elseStat=statement();
>> 
>>       state._fsp--;
>>       if (state.failed) return ;
>> 
>>       }
>> 
>>   }
>> 
>> However, v3.3 generates the following code from the same grammar:
>> 
>>   public final void synpred137_Java_fragment() throws RecognitionException {   
>>       JavaParser.statement_return elseStat = null;
>> 
>> 
>>       // [... some comments not relevant here ...]
>>       {
>>       match(input,ELSE,FOLLOW_ELSE_in_synpred137_Java9244); if (state.failed) return ;
>>       pushFollow(FOLLOW_statement_in_synpred137_Java9248);
>>       elseStat=statement();
>> 
>>       state._fsp--;
>>       if (state.failed) return ;
>> 
>>       }
>>   }
>> 
>> The complete grammars can be found at ...
>> http://www.habelitz.com/index.php?option=com_content&task=view&id=12&Itemid=8
>> 
>> Any hints? A bug within v3.4?
>> 
>> Ciao
>> Dieter
>> 
>> 
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 



More information about the antlr-interest mailing list