aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes C++ code parsing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "C++ code parsing" Watch "C++ code parsing" New topic
Author

C++ code parsing

Marek Krzeminski
Greenhorn

Joined: Mar 13, 2011
Posts: 14

I'm not sure if this is the right place to post this question but here goes.

I would like to write a C++ parser that can take .h and .cpp files and give me a listing of functions and variables that are stored in those files. Does anyone have suggestions on how I can do this?


3D OpenGL, C++ Game Development Video Tutorials @
www.marekKnows.com
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2476
    
    7

A wild idea:

search for some open source c++ compiler, and use it's code parsing capabilities, or
search for some open source c++ IDE, and learn how it understands c++ code.


OCUP UML fundamental and ITIL foundation
youtube channel
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
Do you want to do this programmatically using Java? If so, check out the eminent parser generators (JavaCC, Antlr, SableCC) - one of them is bound to have a ready-made grammar for C++ that you can use.


Ping & DNS - updated with new look and Ping home screen widget
Marek Krzeminski
Greenhorn

Joined: Mar 13, 2011
Posts: 14

using an existing C++ compiler is an interesting idea, however licensing this code could be tricky.

I plan on doing all of this work in C++ myself.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
Well, my reply would apply to parser generators written in C++ as well - just using different libraries, like bison.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: C++ code parsing
 
Similar Threads
Compiler Error Version Problem
how to set java env variables
how to read and list files in Jsp List
problem calling a remote webservice [ Algo Error]
Multiple JDK's and JRE's