[antlr-interest] ANTLRWorks generating cpp files.

Jim Idle jimi at temporal-wave.com
Mon Jul 9 13:10:18 PDT 2012


You are adding the headers in the wrong @section of the grammar. Look at
the docs and you will see that there are various places that you can
inject code lines. One of these is outside the extern "C" set. However, I
would advise that you try and separate your C++ out of the actual grammar
itself.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Murat Atalay
> Sent: Monday, July 09, 2012 11:23 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] ANTLRWorks generating cpp files.
>
> Hello Everyone,
>
> I have question about generating cpp files with ANTLRWorks. I would
> like to generate compile-able CPP files.
>
> ANTLRWorks only generates C files which also can be compiled by CPP.
> But I have to go in to header files and comment out some of the lines,
> such as;
>
> //extern "C"{
> //..
> //}
>
> Because i'm adding specific CPP libraries (STL) in to my grammer and it
> doesn't work properly unless I comment out those lines. I was wondering
> is there any way to do this automated. I keep update my grammar and
> then I have to go in to my header files and comment these out and its
> kinda annoying.
>
> Can we quickly add CPP language support to ANTLR. At least it can
> remove the lines given above.
>
> Please let me know if anyone has any ideas about it.
>
> Thanks,
> Murat
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list