Gcc Xml Function Bodies
Implementing function bodies for GCCXML
GCCXML is an XML backend to the GCC. If you know what that means, skip the next section. Otherwise read the gentle introduction below.
Gentle introduction
I'll give my very best to make this as painless as possible for the non-technical reader. I know that I'm being just soooooooo vague.
GCC is short hand for "GNU compiler collection".
This is the de facto standard compiler for Unix derivative operating systems, like Linux or BSD. It is also available for other platforms. See the MinGW project for a Windows implementation for example.
If you don't know, what a compiler is: It is a translator for the computer. It takes one language (a programming language) as input and produces output in another language (e.g. machine code).
Most (imperative) programming languages support grouping code into very basic "building blocks" that can be reused, called functions (or procedures or subroutines or ...). Just because "use" would be to easy to follow, programmers don't "use" functions -- we call them.
Functions (and a lot of other things) must be declared. This means, that you tell the compiler about it, so it knows what to expect, when it finds it during translation. But of course that's not everything. A function also must be defined. This is the actual fun part where programmers specify the code to be executed.
So please allow me yet another analogy to introduce yet another terminology: If a function was a document, you could think of the declaration as the header and the definiton would be the body of the document.
There you go. That's what function bodies are. The code.
"Why are you doing this?!"
Well... because. :-)
Oh, that's not enough explaining? OK, here you go.
You use GCC to compile C++ (input) to machine code (output). So far so good. Let's say I want to create a tool that analyzes C++ code. I could read in the C++, that's true, but it's oh so much trouble. I'd have to write a compiler my self. But machine code is not exactly what I'd like to read either...
GCCXML will translate the C++ input into XML output. XML is a good choice as it is an open standard of the W3 consortium and a lot of tools are readily available.
Well, if you want a different output, that might be more useful to other programming tools, XML is the technology of choice those days. But: GCCXML so far only tells you about the declarations in the C++ code. That means, I could only analyze what's in there, but not, how it's interconnected.
And as things developed I had to write my graduation thesis and get information out of C++ code. I needed to know those function usage interconnections. But I was lucky: All I needed to do for the thesis, was to show it's possible to extract the information this way by getting a very rought prototype working.
Graduation is over. Now I'll carry on.