473,546 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making a C Refactoring Program

Hi I'm currently in the midst of building a C high-level refactoring
program in Java but I was wondering if there are any good parsers (or
some other alternative) which are able to read in C files at a
function or global level and allow transformations to the code, in
other words it will allow me to swap a function out of one file and
into another using the api etc...

ATM I'm using ANTLR to generate a C Lexer/parser from a C grammar file
and then using that lexer/parser to read in all the code into an
internal tree structure but that seems abit excessive...

Cheers

P.S Also any references to similar software out there which maps out C
(or some other language) projects would be greatly appreciated.
Mar 26 '08 #1
2 1564
pi******@gmail. com wrote:
Hi I'm currently in the midst of building a C high-level refactoring
program in Java but I was wondering if there are any good parsers (or
some other alternative) which are able to read in C files at a
function or global level and allow transformations to the code, in
other words it will allow me to swap a function out of one file and
into another using the api etc...

ATM I'm using ANTLR to generate a C Lexer/parser from a C grammar file
and then using that lexer/parser to read in all the code into an
internal tree structure but that seems abit excessive...

Cheers

P.S Also any references to similar software out there which maps out C
(or some other language) projects would be greatly appreciated.
Since you are doing this in Java may be you can adapt the following
software to your needs?

<http://www.eclipsecon. com/articles/Article-LTK/ltk.html>

Also:

<http://www.refactoring .com/tools.html>
<http://www.joanju.com/dist/docs/tree_manip.html >

Mar 26 '08 #2
Hi thanks for all the replies.

I know it's going to be hard performing lower-level code refactoring
with C and if I did attempt it, it would really only be with
preprocessed code. Alot of refactoring patterns don't seem to suit
structured programming languages very well, you're left with only a
basic subset of fairly basic refactorings that are still applicable.

I'm focusing more on the higher-level file-level refactorings like if
say a certain function gets used alot in a particular file then it may
be better to move that function to that file if it's currently in a
different one, the same with global declarations etc..

So I would really only need basic parsing capability or better still
an existing basic program that lays out out the dependencies. I looked
at CDepend but the original author mentioned that it hadn't been
updated in awhile so it would be better to use objdump though that's a
little too sparse..

BTW does anyone know whether there's any research or literature that
focuses purely on the higher-level refactorings rather than basic low-
level code refactorings? Or is that going to be refactoring in
entirely different context? I'm finding it hard to put down the right
term for it.

Cheers and again thanks for the help so far.
Mar 26 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1592
by: | last post by:
Hi, Refactoring a winform causes problems if moving this form to a subdirectory in the same project. What is the workaround for this and will this be fixed in future? Thanks /BOB
2
2090
by: Sachin Garg | last post by:
Hi, I was trying to find (like many others here) a tool for refactoring C++ code as I have lately been noticing that I spend most of my coding time doing refactoring and some refactoring which I skip, due to the enormous effort it seems to require, usually comes back to me with larger costs. I read a few comp.lang.c++ threads over past...
11
3255
by: Master of C++ | last post by:
Hi, I am writing a simulation package in C++, and so far I've written about 8000 lines of code and have about 30 classes. I haven't used C++ exceptions so far (for various reasons). The only two "resources" I use are memory and file I/O and whenever there is a memory allocation failure or file I/O failure I just simply call a custom...
10
1855
by: Jeff Grills | last post by:
I am an experienced C++ programmer with over 12 years of development, and I think I know C++ quite well. I'm changing jobs at the moment, and I have about a month between leaving my last job and starting my new one. In that time, I have decided to learn C#. I picked up the book, "Programming C# (4th Edition)" recently and have read most of...
34
3672
by: Asfand Yar Qazi | last post by:
Hi, I'm creating a library where several classes are intertwined rather tightly. I'm thinking of making them all use pimpls, so that these circular dependancies can be avoided easily, and I'm thinking of making all these pimpl class declarations public. Reasoning is that since only the code within the ..cc file will need to ever access...
0
772
by: andrews | last post by:
Hi, I use vb.net express and I have installed the program refactoring (microsoft) But when I make a program in VB.net I don't see how I can use this refactoring program How can I start and use this program. Thanks for any response
15
4372
by: Simon Cooke | last post by:
Does anyone know of any tools for refactoring header files? We're using a third party codebase at work, and pretty much every file includes a 50Mb precompiled header file. I'm looking for a tool that will let us figure out which header files are actually needed by each .cpp, and allow us to break this up so that we're not including the world...
17
1970
by: ToddLMorgan | last post by:
I'm just starting out with python, after having a long history with Java. I was wondering if there were any resources or tips from anyone out there in Python-land that can help me make the transition as successfully as possible? Perhaps you've made the transition yourself or just have experience with folks who have made the transition. I'm...
4
1626
by: shuisheng | last post by:
Dear All, I have a code developed by former employees. I extract some part of it as below: // definition of class CWNPrimitiveFace, it represent a face class CWNPrimitiveFace : public CWN3DObjBase { friend ofstream& operator<<( ofstream& f, CWNPrimitiveFace& obj ); friend ifstream& operator>>( ifstream& f, CWNPrimitiveFace& obj );
0
7435
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7794
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.