[antlr-interest] ANTLR v3.4 generates compiler errors (that v3.3 doesn't generate)

Kieran Simpson kierans777 at gmail.com
Tue May 1 02:37:30 PDT 2012


Again another poke for this issue which is still a bug in the C target.

kierans/antlr3 on Github has an attempt of the port of the Java fix 
which Jim did say he'd have a look at.

Any word on this?

Cheers,

On 23/07/64 5:59 AM, Terence Parr wrote:
> grab antlr/antlr3 from github which has the fix.
> Ter
> On Apr 30, 2012, at 10:05 AM, Pedro Francisco wrote:
>
>> Sorry for the poke but... any news on this? (getting "void  =ll;")...
>>
>> On Mon, Oct 24, 2011 at 8:24 PM, Eric<researcher0x00 at gmail.com>  wrote:
>>> On Mon, Oct 24, 2011 at 10:41 AM, Dieter Habelitz<
>>> dieter.habelitz at habelitz.com>  wrote:
>>>
>>>> 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=atement
>>>>        (   ELSE elseStat=atement ->  ^(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  =ll;):
>>>>
>>>>    public final void synpred137_Java_fragment() throws RecognitionException
>>>> {
>>>>        void  =ll;
>>>>
>>>>        // [... some comments not relevant here ...]
>>>>        {
>>>>        match(input,ELSE,FOLLOW_ELSE_in_synpred137_Java9244); if
>>>> (state.failed) return ;
>>>>
>>>>        pushFollow(FOLLOW_statement_in_synpred137_Java9248);
>>>>        elseStat=atement();
>>>>
>>>>        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 =ull;
>>>>
>>>>
>>>>        // [... some comments not relevant here ...]
>>>>        {
>>>>        match(input,ELSE,FOLLOW_ELSE_in_synpred137_Java9244); if
>>>> (state.failed) return ;
>>>>        pushFollow(FOLLOW_statement_in_synpred137_Java9248);
>>>>        elseStat=atement();
>>>>
>>>>        state._fsp--;
>>>>        if (state.failed) return ;
>>>>
>>>>        }
>>>>    }
>>>>
>>>> The complete grammars can be found at ...
>>>>
>>>> http://www.habelitz.com/index.php?option=m_content&task=view&id&Itemid=8
>>>>
>>>> Any hints? Switch back to org.antlr.Tool 3.3
>>>
>>>
>>>
>>>
>>>> A bug within v3.4? Yes
>>>>
>>>
>>> Ter is aware of it but is holding off on fixing the bugs for org.antlr.Tool
>>> 3.4.


More information about the antlr-interest mailing list