[antlr-interest] void* conversion in C runtime

Robert Soule robert.soule at gmail.com
Mon Feb 23 10:16:32 PST 2009


I am also getting compiler errors in 3.2.2 code that works with 3.1.1.
I believe there
is an extra ")" in the generated code:

 // Foo.g:127:108: ( '.' IDENTIFIER )*
 {
  while ( (stream_IDENTIFIER != NULL &&
             stream_IDENTIFIER->hasNext(stream_IDENTIFIER)) ||
             stream_207 != NULL &&
             stream_207->hasNext(stream_207))  )      // Line 11798 here.
  {
    // some other code
  }
 // some other code
}

FooParser.cpp:11798: error: expected primary-expression before ')' token
FooParser.cpp:11798: error: expected `;' before ')' token



On Sun, Feb 22, 2009 at 12:17 PM, Terence Parr <parrt at cs.usfca.edu> wrote:
> Hi Jim is away for a week now; he should take a look when he comes back.
> Ter
> On Feb 22, 2009, at 4:47 AM, Gary R. Van Sickle wrote:
>
>> Hi Jim,
>>
>> Looks like you may have "missed a spot" or two.  With the recent 3.1.2
>> release I'm getting a number of such errors.  E.g. here's one:
>>
>>
>> static pss9_combined_lexer_parserParser_declaration_SCOPE
>> pss9_combined_lexer_parserParser_declarationPush
>> (pss9_combined_lexer_parserP
>> arser ctx)
>> {
>>    /* Pointer used to create a new set of attributes
>>     */
>>    pss9_combined_lexer_parserParser_declaration_SCOPE
>> newAttributes;
>>
>>    /* Allocate the memory for a new structure if we need one.
>>     */
>>    if
>> (ctx->pss9_combined_lexer_parserParser_declarationStack->size(ctx-
>> >pss9_comb
>> ined_lexer_parserParser_declarationStack) >
>> ctx->pss9_combined_lexer_parserParser_declarationStack_limit)
>>    {
>>        // The current limit value was less than the number of scopes
>> available on the stack so
>>        // we can just reuse one. Our limit tracks the stack count,
>> so the
>> index of the entry we want
>>        // is one less than that, or conveniently, the current value of
>> limit.
>>        //
>>       ///// GRVS: HERE'S THE ERROR:
>>        newAttributes =
>> ctx->pss9_combined_lexer_parserParser_declarationStack->get(ctx-
>> >pss9_combin
>> ed_lexer_parserParser_declarationStack,
>> ctx->pss9_combined_lexer_parserParser_declarationStack_limit);
>>    }
>>    else
>>    {
>>        // Need a new allocation
>>        //
>>        newAttributes =
>> (pss9_combined_lexer_parserParser_declaration_SCOPE)
>> ANTLR3_MALLOC
>> (sizeof(ss9_combined_lexer_parserParser_declaration_SCOPE));
>>        if  (newAttributes != NULL)
>>        {
>>            /* Standard ANTLR3 library implementation
>>             */
>>
>> ctx->pss9_combined_lexer_parserParser_declarationStack->push(ctx-
>> >pss9_combi
>> ned_lexer_parserParser_declarationStack, newAttributes, (void (*)(void
>> *))declarationFree);
>>        }
>>    }
>>       [...etc...]
>>
>>
>> This gets me the following error from gcc:
>>
>> ss9_combined_lexer_parserParser.cpp: In function
>> `ss9_combined_lexer_parserParser_declaration_SCOPE_struct*
>> pss9_combined_lexer_parserParser_declarationPush
>> (ss9_combined_lexer_parserPa
>> rser_Ctx_struct*)':
>> ss9_combined_lexer_parserParser.cpp:353: error: invalid conversion
>> from
>> `void*' to `ss9_combined_lexer_parserParser_declaration_SCOPE_struct*'
>>
>> There's different breakage as well.  Check this out:
>>
>>
>>       if      (SCOPE_TOP(external_declaration)>free != NULL)
>>       {
>>
>> SCOPE_TOP(external_declaration)>-
>> >free(SCOPE_TOP(external_declaration));
>>       }
>>
>>
>> Not quite sure what's going on there, but in the first case it looks
>> like
>> there's one too few "-"'s and in the second one too many ">"'s
>> before the
>> "free".
>>
>> --
>> Gary R. Van Sickle
>>
>>
>>> -----Original Message-----
>>> From: antlr-interest-bounces at antlr.org
>>> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
>>> Sent: Saturday, February 21, 2009 7:46 PM
>>> Cc: antlr-interest at antlr.org
>>> Subject: Re: [antlr-interest] void* conversion in C runtime
>>>
>>> Robert Soule wrote:
>>>> Hi Jim,
>>>>
>>>> Is there a stable version of the antlr tool jar that supports this
>>>> change? I got:
>>>>
>>>> antlr-3.1.2-SNAPSHOT-jar-with-dependencies.jar
>>>>
>>>> from:
>>>>
>>>>
>>> http://antlr.org/hudson/job/ANTLR_Tool/lastSuccessfulBuild/org.antlr
>>> $a
>>>> ntlr/
>>>>
>>>> but the code it generates doesn't compile. I see from the web page
>>>> that there are 17 failures in the unit tests.
>>>>
>>>
>>> Unit tests are known failures, mostly down to the tests
>>> themselves, but you can download the 3.1.2 release now from
>>> the main download page.
>>>
>>> Jim
>>>> thanks,
>>>> Robert
>>>>
>>>>
>>>> On Fri, Feb 20, 2009 at 4:00 PM, Jim Idle
>>> <jimi at temporal-wave.com> wrote:
>>>>
>>>>> Robert Soule wrote:
>>>>>
>>>>>> I am using antlr-3.1.1.jar and libantlr3c-3.1.2.b1.
>>>>>>
>>>>>> If this change doesn't get into the official release, can I get a
>>>>>> copy from cvs or something?
>>>>>>
>>>>>>
>>>>> I have just fixed it, so that one will be in the release.
>>>>>
>>>>> In order to get other fixes like this, you need to use the
>>>>> 3.1.2-SNAPSHOT jar. You can get the latest jars by visiting
>>>>> org.antlr/hudson, where you will be able to pick up that
>>> change later
>>>>> this afternoon (check the recent changes link).
>>>>>
>>>>> Jim
>>>>>
>>>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>>>> Unsubscribe:
>>>>>
>>> http://www.antlr.org/mailman/options/antlr-interest/your-email-addres
>>>>> s
>>>>>
>>>>>
>>>
>>>
>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>> Unsubscribe:
>>> http://www.antlr.org/mailman/options/antlr-interest/your-email
>> -address
>>
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
> 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