[antlr-interest] void* conversion in C runtime

Jim Idle jimi at temporal-wave.com
Fri Feb 20 12:40:37 PST 2009


Robert Soule wrote:
> Hi Jim,
>
> I am trying to write a tree grammar that recognizes an AST
> and produces a second AST, using the C runtime, but compiling
> with a C++ compiler.
>
> In the generated code, I get a problem at lines that look like:
>
> 	retval.tree = ADAPTOR->rulePostProcessing(ADAPTOR, root_0);
>
> In my grammar file which produces the first AST, the generated
> code has the cast to let this be C++ compliant:
>
> 	retval.tree = (pANTLR3_BASE_TREE)(ADAPTOR->rulePostProcessing(ADAPTOR,
> root_0));
>
> Would it be possible to add the casts for tree grammars as well please?
>   
Yes - though I am a little unsure if I will get these changes in before 
3.1.2 now :-( You are using the very latest ANTLR tool and C runtime right?
> Also, does the C runtime support AST to AST rewrite rules? So something like:
>
> myrule: ^(A foo bar) -> ^(B bar foo);
>   
Yes.

Jim


More information about the antlr-interest mailing list