[antlr-interest] help with modifying c++ code

Bharath Devanathan bharath_d at yahoo.com
Wed Mar 15 13:56:31 PST 2006


Hello all,

I am at a situation where we need to break binary compatiblity. As a result a lot of code has to be changed and recompiled. I am looking into automating this task.

For example, lets say I have a class A that looks like this

class A
{
  char* name;
};

After the binary compatibility change has been made, class A now will look like

class A
{
  char* name();
};


So for all code that used to refer A now has to change .

A* p;

After the change made to class A, tp->name has to change to p->name();

We have many more cases like this, but what I have described is a simplified view of the problem. 

What I am looking to do is to say

1. Find all variables of type A
2. For all these variables that match a certain criteria, (for ex variable->name), change the code to be something else. (variable->name())


I stumbled upon ANTLR from a websearch, and havent read enough about it yet. I would like to know if ANTLR is the right tool for this kind of job. If not, can someone on this list point me in the right direction?

Thanks in advance,
Bharath





More information about the antlr-interest mailing list