 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Andre Baresel Guest
|
Posted: Sat Dec 27, 2003 10:14 am Post subject: C++ Refactoring Tool |
|
|
Hello together,
just a year ago I was searching arround for a tool supporting refactoring
for c++.
I've seen implementations for java and was impressed how an IDE can help
with
such a feature.
Just rename classes / member / parameter with a mouse click.
reduce the size of a method by transforming parts of it into a seperate
function
(just by selection and 'do-refactor-out').
But than the bad news - no C++ IDE does support that. Can you imagine why ?
Two arguments I've seen during web search:
- "C++ syntax parsing is hard" I must say - yes it is. Parser
generators don't get it completly.
- "C++ has this nasty preprocessing" Am, yes that makes it a little bit
harder
- "c++ has these template things" Well, declaration constructs can
be a little bit more complex ;)
However, I finally found a project targeting the problem. It is called
"CppTool" on Sourceforge.
A name not very impressive and it started in late 2001. After one year
discussion about how to write
a full c++ parser. Some new members created an idea which convinced me.
Baptiste Lepilleur
(see CppUnit activities) created the idea of doing "lazy parsing". It is a
hand written parser, which is
able to parse only fragments of the code - this is great, since that enables
us to parse only these parts
which we need to know about. An example:
let's say, we know that we are inside a compound statement. that enables us
to seperate all
declaration and statements just by searching for ';' Next step is to decide
if it's a
declaration or statement.
Well, and what to say - after 3 month we have this parser can handle full
files. Not yet getting
all the details, but this is just a question of time.
You will ask - what is there now ?
Important thing first:
- we implemented some simple refactoring (e.g. local variable rename,
split declaration)
- we have an integration for Eclipse and Visual-Studio.
- we are open to any IDE (as long as the IDE is open for
plugin/extensions)
What about these nasty C++ things ?
- the parser does create an AST for C++ Sources
- templates in programs can be parsed
- preprocessing has solved for simple macro replacements
(we keep them as long as they do not conflict a refactoring)
After all, we are only two active programmers. Don't you want to take part
in this
important project ? Just read the mailing lists "cpptool-develop Archive" or
contact
me. I would like to send a first example of the plugins to you.
Check out the sources, well there's much. But just ask me to seperate
important things...
Don't you think that this will be worth ?
See you soon at CppTool: https://sourceforge.net/projects/cpptool/
André Baresel
(netmemberab)
----------------------------------------------------------------------------
-------
btw) if you scan through the net in todays time you will also see that the
eclipse project CDT is targeting refactoring, unfortunatly i don't see
progress
on this front and they have even not solved the basic problems. The mile
stones
tell that some very basic rename feature is planned for summer 2004.
However,
I have seen such point also on the time table for this year 2003 - ... I
really like
eclipse, however what is with all there programmers working with borland /
visual studio
because of this COM/ActiveX features.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|