[antlr-interest] void* conversion in C runtime

Robert Soule robert.soule at gmail.com
Fri Feb 20 12:36:39 PST 2009


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?

Also, does the C runtime support AST to AST rewrite rules? So something like:

myrule: ^(A foo bar) -> ^(B bar foo);

thank you,
Robert


More information about the antlr-interest mailing list