[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Translation of C structs into IDL ones: can SableCC do the trick?

To the SableCC ML, and to Mr. Etienne Gagnon

I am faced with quite a complex problem to solve and I was wondering if 
SableCC could help me.
I am in charge of rewriting some old tasks of a project which are written 
in C (or C++ used as a "more powerful" C). These executables actually 
communicate with each other using a custom-developed message broker, and 
the data they trade are defined as big C data structs which can have up to 
20-30 fields, some of which are even composite ones (i.e. structs 
containing other structs).

I'd like to rewrite those tasks in C++ and CORBA: but since the data that 
the new version would exchange would largely consist of the very same 
structures and fields (although the design and philosophy behind the new 
approach are quite different) I thought of recycling most structure 
declarations by turning them into IDL (Interface Definition Language) 

Here comes the core question: could SableCC be used to write a converting 
parser between C(++) and IDL?
I know this is likely to be a hopeless task, but I would like to 
investigate some smarter approach than rewriting all structs from scratch. 
Of course not everything could be recycled, but at least I might give it a try.

Therefore, I am looking for an IDL grammar, a C/C++ grammar (or a subset of 
it that I might customize to suit my needs) and some hints/clues/whatever 
to lead me into the right way, or just convince me I should give up right 
way :-))

Any help will be wholeheartedly appreciated,
Emmanuele Sordini