probably the best C++ parser...

Vladimir Prus ghost at
Mon Jul 4 08:27:17 UTC 2005

On Friday 01 July 2005 19:01, Alexander Neundorf wrote:
> can find is gcc, but did you know gccxml
> ( ? It's basically the real gcc, but
> it doesn't produce machine instructions, but an xml file describing the
> source file.
> So you get
> -all functions
> -all variables
> -all parameters for functions
> -the locations where the functions are declared (file and line number)
> etc. in a machine-readable format.

As I've mentioned already, gccxml does not say anything about function bodies, 
so there still should be code to decided that 'v' variable is std::vector and 
not my_namespace::vector, and not my_base_class::vector, and what not.

IMO, the optimal solution would be to use gcc parser running in background. 
So, as you type, the parser will consume the tokens you've typed, and provide 
exact information about type/members and so on. 

That would require, however, some support for rewinding -- so if you edit in 
the middle of the file,  parser forgets previously read reminder of the file.

Another C++ parser I know about is Synopsis 
(, which is reported to even parse Boost. 

At this point, I'm not quite sure if hacking gcc or improving Synopsis is the 
best way to go.

- Volodya

More information about the KDevelop-devel mailing list