"Herby" <pr********@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
Hi,
Im interested in Reverse Engineering C++ source code into a form more
comprehensible than the source itself.
I want to write a basic one myself, obviously i need to write a parser
for the source code.
You don't need to write a parser to do reverse engineering.
It is probably true that to do reverse engineering, you will need a parser.
Building a C++ parser is lot harder than people who have not
done it think it is. You need a lexer, covering all the standard's dark
corner requirements.
You need a preprocessor. You need a non-standard parsing
engine because C++ isn't LALR, and yacc won't work.
You need a grammar not just for ANSI C++ but for the dialect
of C++ you actually have (Sun? GNU? Microsoft?)
If you are a realist, you'll need a symbol table telling you
where names are defined and what they are defined as, that
is scope accurate. Expect building a robust parser to take several
man-years
at a minimum; we have considerably more than that in ours
to address the above issues.
Although this has some overlap with say a compiler it would also seem
significantly different too.
Ours captures comments and most preprocessor conditionals unexpanded.
Can anyone provide me with links etc on how one would go about writing
such a parser?
No doubt i would also need a reference to the syntax rules of C++ etc.
Check comp.compilers and various conferences on reverse engineering.
You won't find a lot of specific detail; you'll find tantalizing hints of
how to solve problems but that won't remove the sweat
equity required. I've been down that route.
Secondary can anyone recommend a good tool that currently exists to do
the job?
Depends on what you mean by "reverse engineering".
If what you want are all the above features packaged in a form in
which you can construct a reverse engineering tool,
then DMS may suit your needs:
http://www.semanticdesigns.com/Produ...pFrontEnd.html
If you mean "a tool that does reverse engineering", then Scientific
Toolworks may have what you want.
Thanks.
--
Ira Baxter, CTO
www.semanticdesigns.com