[antlr-interest] C Target Question: compiling under C++

Colin Fraizer antlr at cfraizer.com
Wed Nov 5 12:34:31 PST 2008


I apologize for the newbie question, but I'm somewhat new to ANTLR.

 

I want to build a parser for a domain-specific language. I would like to use
C++ for my implementation and understood that the C target would generate
code that compiles under C++, but I'm running into trouble. (Perhaps I've
just misunderstood. If so, I'm sorry.)

 

When I select these options:

{

                language=C;

                output=AST;

                backtrack=true;

                ASTLabelType=pANTLR3_BASE_TREE;

}

 

ANLTR generates a parser which contains lines like this:

                                        root_1 =
(pANTLR3_BASE_TREE)(ADAPTOR->becomeRootToken(ADAPTOR,
stream_oper->nextToken(stream_oper), root_1));

 

but my C++ compiler complains that the return type of stream_oper->nextToken
is "void *", which cannot be converted to 'pANTLR3_COMMON_TOKEN' without a
cast.

 

Any suggestions on how to avoid this? (Or is the answer: just use C?)

 

Thanks in advance,

Colin Fraizer

Indianapolis, IN

antlr at cfraizer.com // (yeah, I use a separate mailbox for this mailing list.
I'm not claiming to be "Mr. Antlr" or anything. 8-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081105/1fe37589/attachment.html 


More information about the antlr-interest mailing list