473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1554
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
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
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...
11
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...
10
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...
34
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...
0
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...
15
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...
17
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.