[antlr-interest] antlr2-C++ target patching?!

Kieran Simpson kierans777 at gmail.com
Mon Feb 20 16:29:40 PST 2012

I have to agree here.  I've been using the C target from within a wider 
C++ application using this process.  It's a bit fiddly keeping the code 
organised properly so that C++ constructs don't leak into the extern C 
code (via header includes) but it does result in some very modular code 
which is nice.

If you want specific details let me know.


On 23/07/64 5:59 AM, Jim Idle wrote:
> You should not be using C++ inside the actions. Create a helper class, and
> call from it. The headers are extern "C" and then compiler the generated C
> as C++ and you are fine. I doubt that anyone will be patching 2.7.7 C++
> target.
> Jim
>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>> bounces at antlr.org] On Behalf Of Oliver Kowalke
>> Sent: Sunday, February 19, 2012 5:31 AM
>> To: antlr-interest Interest
>> Subject: [antlr-interest] antlr2-C++ target patching?!
>> Hi,
>> I'm forced to use antlrv2 because antlr3 does not support C++!
>> The C target encloses the generated lexer/parser code in 'extern "C"'
>> which prevents using C++ constructs (like templates or constructs from
>> other C++ libs) inside the parser.
>> I found that the last version of antlr2 (2.7.7) requires a patch
>> because of missing headers.
>> Where do I have to post this patch?
>> regards,
>> Oliver

More information about the antlr-interest mailing list