[antlr-interest] Help with error in C code generation (3.1)

Patrick McCormick pat at lanl.gov
Thu Aug 21 16:30:42 PDT 2008


Hi,

I've run into some issues with generating C code under the 3.1 release  
(that is being compiled as part of a C++
project).  The errors I'm seeing are in the generated C code that is  
being compiled as C++ source:

	antlr/SParser.cpp:14982: error: invalid conversion from ‘void*’ to  
‘ANTLR3_BASE_TREE_struct*’

This corresponds to this line in the generated parser:

	 string_literal17_tree = ADAPTOR->create(ADAPTOR, string_literal17);

In looking over the code generation templates it appears that there is  
really only on possibility as to where
this is being generated from.  Here are the possible spots (the first  
one clearly missing a cast like the others):

	ASTParser.stg:<label>_tree = ADAPTOR->create(ADAPTOR, <label>);
	ASTParser.stg:<label>_tree = (<ASTLabelType>)(ADAPTOR- 
 >create(ADAPTOR, <label>));
	ASTParser.stg:<label>_tree = (<ASTLabelType>)(ADAPTOR- 
 >create(ADAPTOR, <label>));

I'm assuming adding the cast would fix this but I haven't been able to  
rebuild ANTLR successfully
from the source distribution to test it out.  I'm running under MacOS  
X 10.5.4 with XCode 3.1 installed.
I'm a newbie to both Java and ANTLR so any help would be  
appreciated.   In particular, I'd like to know how
I go about rebuilding the source distribution -- I'm using ant but get  
hundreds of errors during the build.

Thanks for any help you can provide,

--Patrick






More information about the antlr-interest mailing list