[antlr-interest] Re: a quick one!

mehdi_cit mehdi_cit at yahoo.com
Thu Dec 25 11:52:40 PST 2003


Hi Ter,

Believe me I did a search and read tons of posts. I understood that 
parsing C++ was difficult (I had a look at the grammar, furtively 
though). But I would think that parsing the C++ code just to add 
some "easy funtions" like adding a toString(); function to all 
classes wouldn't be that hard.

For instance a class 

classA{ 
int i;
int j;
...
}

Parsing the code would generate

classA::toString(){
cout << "i: " << i << ", " << "j: " << j << endl;
....
}


Is that possible with ANTLR?

I read once about some product that parses C++ and offers a Script 
like language (interface) to walk the tree and generate C++ code or 
whatever. But I cannot find it anymore... 

Anyways... I'm really in an extreemly bad mood :(. I accepted some 
project and I'm stuck now... I have been told that there exists some 
C++ grammar and that could be easily done with ANTL. 

Apparently I should have investigated the matter further!

Thank you in any case :)

--- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...> 
wrote:
> 
> On Thursday, December 25, 2003, at 02:15 PM, mehdi_cit wrote:
> 
> > Please someone answer, it wouldn't take you more than 5 minutes!
> 
> I believe you'll see a response to this from a few times in the 
past 
> using a search.  The answer is C++ is really hard to parse...most 
> people parse it in stages, which ANTLR certainly is capable of 
doing.  
> Have you seen the existing C++ grammar on the website?
> 
> Ter
> 
> >
> > I'm investigating ANTLR. I need to know whether there is a viable
> > C++ grammer as I want to be able to parse my C++ code and (let's
> > say) generate some functions for every class (e.g. 
classA.toString
> > (), classA.toSQL()). Is that possible with ANTLR, if yes how do 
we
> > go about it? Please anyone help.... I really need it.
> >
> > I don't need to make some new compiler/language etc. I just need 
to
> > automate some of the coding. Just as I said I need to have some
> > parser that parses my C++ code, checks my classes and auto-
generate
> > some 'straightforward' functions.
> >
> > Please help me!
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> >  http://groups.yahoo.com/group/antlr-interest/
> >
> > To unsubscribe from this group, send an email to:
> >  antlr-interest-unsubscribe at yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to:
> >  http://docs.yahoo.com/info/terms/
> >
> >
> >
> --
> Professor Comp. Sci., University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Co-founder, http://www.jguru.com
> Co-founder, http://www.knowspam.net enjoy email again!
> Co-founder, http://www.peerscope.com pure link sharing


 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list