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. <br>
<br>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 (<a href="http://markmail.org/message/lv2v272mi6njzx5m#query:antlr%20c%2B%2B%20target+page:1+mid:lv2v272mi6njzx5m+state:results">http://markmail.org/message/lv2v272mi6njzx5m#query:antlr%20c%2B%2B%20target+page:1+mid:lv2v272mi6njzx5m+state:results</a>) and from the date it would probably fit in with my mental records as being the last time the request was posted.<br>
<br>For this very reason I actually started using things like Spirit (<a href="http://spirit.sourceforge.net/">http://spirit.sourceforge.net/</a>), and Coco/R (<a href="http://ssw.jku.at/coco/">http://ssw.jku.at/coco/</a>) rather than ANTLR as my parser generation tool when I needed something that worked well with C++.<br>
<br>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?<br clear="all"><br>Granville<br><br>PS. I strongly advise you to post this on the ANTLR mailing list (<a href="http://www.antlr.org/mailman/listinfo/antlr-interest">http://www.antlr.org/mailman/listinfo/antlr-interest</a>), things may have changed since I last looked.<br>

<br><br><div class="gmail_quote">2009/7/11 Vikram S. Adve <span dir="ltr"><<a href="mailto:vadve@cs.uiuc.edu">vadve@cs.uiuc.edu</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="word-wrap: break-word;">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?<div class="im">
<br><div> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="font-family: Helvetica;">
<span style="font-family: Arial;"><font size="3"><span style="font-size: 12px;"><br>--Vikram</span></font></span></div><div><font face="Arial"><i><font size="3"><span style="font-size: 12px;">Associate Professor, Computer Science</span></font></i></font></div>
<div><font face="Arial"><i><font size="3"><span style="font-size: 12px;">University of Illinois at Urbana-Champaign</span></font></i></font></div><div><font face="Arial"><i><font size="3"><span style="font-size: 12px;"><a href="http://llvm.org/%7Evadve" target="_blank">http://llvm.org/~vadve</a></span></font></i></font></div>
<div><font face="Arial" size="3"><span style="font-size: 12px;"><i><br></i></span></font></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></span></div></span></div>
</span><br> </div><br></div><div><div><div></div><div class="h5"><div>On Jul 11, 2009, at 3:00 PM, Granville Barnett wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div class="h5">Hi,<br><br>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.<br clear="all">
 <br>Granville<br> <br><br><div class="gmail_quote">2009/7/11 Vikram S. Adve <span dir="ltr"><<a href="mailto:vadve@cs.uiuc.edu" target="_blank">vadve@cs.uiuc.edu</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 <div style="word-wrap: break-word;">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,<br>
 <div> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="word-wrap: break-word;">
 <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 11px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style="font-family: Helvetica;">
 <span style="font-family: Arial;"><font size="3"><span style="font-size: 12px;"><br>--Vikram</span></font></span></div><div><font face="Arial"><i><font size="3"><span style="font-size: 12px;">Associate Professor, Computer Science</span></font></i></font></div>
 <div><font face="Arial"><i><font size="3"><span style="font-size: 12px;">University of Illinois at Urbana-Champaign</span></font></i></font></div><div><font face="Arial"><i><font size="3"><span style="font-size: 12px;"><a href="http://llvm.org/%7Evadve" target="_blank">http://llvm.org/~vadve</a></span></font></i></font></div>
 <div><br></div><div><font face="Arial" size="3"><span style="font-size: 12px;"><i>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.</i></span></font></div>
 </span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></span></div></span></div></span></div></div><br>_______________________________________________<br> LLVM Developers mailing list<br>
 <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
 <br></blockquote></div><br> </div></div><span><ATT00001.txt></span></blockquote></div><br></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br>