[antlr-interest] Antlr3 C code

Jim Idle jimi at temporal-wave.com
Mon Mar 9 08:38:28 PDT 2009


Gabriele Palma wrote:
> Hi, i'm using antlr v 3 with antlrworks and visual studio 2008.
>
> First thing i would like to know if there's a forum/mailinglist
> regularly read where i can eventually get some basic support on this
> tool or if it is ok to use the email as in this case.
>
> Second thing, when trying to force compile in c++ the generated c
> sources i get this error (the grammar in taken from the C samples,
> somehow modified to include some code)
>
> Error	2	error C2440: '=' : cannot convert from 'void *' to
> 'pCParser_Symbols_SCOPE'	d:\documenti\visual studio
> 2008\projects\cparser\cparser\antlr3 autogen\cparser.c	261	CParser
>
> at this code:
>
> /* Allocate the memory for a new structure if we need one.
>      */
>     if (ctx->pCParser_SymbolsStack->size(ctx->pCParser_SymbolsStack) >
> ctx->pCParser_SymbolsStack_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.
>         //
>         newAttributes =
> ctx->pCParser_SymbolsStack->get(ctx->pCParser_SymbolsStack,
> ctx->pCParser_SymbolsStack_limit); <-----here
>     }
>
> Everything is ok if i do not force compile in c++ but let VS compile in C
>
> What i'm doing wrong? (note that the code is not from the actions
> inside my grammar)
>   
Make sure that you are using the latest download from the web site. 
There was a bug here with casting for C++ that is fixed in the code 
generation templates for the current tool download. 3.1.2-1 is the jar 
you will get from the web site download page.

Also look out for a patch to the C runtime later this week to fix an 
issue with converting some tokens to strings.

Jim



More information about the antlr-interest mailing list