[antlr-interest] New to Antlr: need guideline for parsing C++ header file.

Terence Parr parrt at cs.usfca.edu
Tue Mar 16 09:30:37 PST 2004


On Mar 16, 2004, at 5:20 AM, salee2945 wrote:
> Now I am thinking if generating general C++ parser is an overkill to
> parse only header files for things like: class names, base class
> names, virtual methord names, and their parameters.
>
> Could anyone tell me if I am in the right track? If not, any
> suggestion?

Howdy.  My experience is that the declarations outside of function 
bodies is just not that bad in C++.  it's the actions and other crap 
inside function bodies that will kill you.  In the old days I built a 
C++ header file reader for a large company with only a few letters in 
their name using PCCTS and while 90,000 line header file expansions can 
produce some damn wacky character sequences, parsing headers is not a 
huge problem.

Remove all the function bodies with a lexer that knows how to match 
curlies and you're golden!  Note that ANTLR can do this with recursion 
in the lexer rather than using an int counter. ;)

Ter





 
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