granvillebarnett at googlemail.com
Sat Jul 11 13:24:16 PDT 2009
When you create a parser via ANTLR you specify the output language of the
resulting recursive descent parser, at the moment there exists no C++ output
template to my knowledge, thus you would have to generate the parser as C
code for which a template exists.
The runtime support should be there, at least partially but it won't use
things like exceptions, nor will it have a very modular design (obviously,
but in reality the C target is pretty good) etc. It would be best for you to
post on the ANTLR mailing list, however, this request has been posted
several times. Jim Idle is the name of the guy who last said he was going to
look at creating a proper C++ target (Jim wrote the C target). After a quick
search I found the following mail archive (
and from the date it would probably fit in with my mental records as being
the last time the request was posted.
For this very reason I actually started using things like Spirit (
http://spirit.sourceforge.net/), and Coco/R (http://ssw.jku.at/coco/) rather
than ANTLR as my parser generation tool when I needed something that worked
well with C++.
I take it though that the main reason you are thinking about using ANTLR is
because of the availability of a pretty good, and existing C++ grammar?
PS. I strongly advise you to post this on the ANTLR mailing list (
http://www.antlr.org/mailman/listinfo/antlr-interest), things may have
changed since I last looked.
2009/7/11 Vikram S. Adve <vadve at cs.uiuc.edu>
> That sounds like a problem. Just so I understand, do you mean there isn't
> the run-time support etc. to write back ends for the C++ language, or that
> the compiler IR is also somehow insufficient to write a code generator?
> *Associate Professor, Computer Science*
> *University of Illinois at Urbana-Champaign*
> *http://llvm.org/~vadve <http://llvm.org/%7Evadve>*
> On Jul 11, 2009, at 3:00 PM, Granville Barnett wrote:
> I've not got any experience using ANTLR to parse C++, however, you will
> find that there only exists a C code generator for ANTLR and NOT a C++ one.
> Over the years numerous people have requested a C++ code generation template
> but alas there is still only a C one. Just a heads up.
> 2009/7/11 Vikram S. Adve <vadve at cs.uiuc.edu>
>> We are looking for an open source C++ parser other than g++ if possible.
>> Clang would be great but its C++ support is still some way away and we need
>> something that works or nearly works now. Does anyone have any experience
>> with ANTLR for parsing C++ and for extending their C++ parser? Any other
>> feedback on ANTLR in general would be welcome too. Thanks,
>> *Associate Professor, Computer Science*
>> *University of Illinois at Urbana-Champaign*
>> *http://llvm.org/~vadve <http://llvm.org/%7Evadve>*
>> *P.S. Sorry for the spam. I know this question is not directly LLVM
>> related but it is peripherally related and this list is the best source I
>> could think of for C++ parsing experience.*
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev