Re: Simple source translation tool? (fwd)


Date: Thu, 17 Feb 2000 22:16:07 -0600 (CST)
From: "Gregory R. Bronner" <gbronner@xxxxxxxxxxx>
Subject: Re: Simple source translation tool? (fwd)
Since more than one person is interested in this, I'll forward it:

Discover, from Software Emancipation Technology (www.setech.com)
can do this.  It isn't easy to do it the first time, but when you figure
out how to do this it is incredibly fast and quite convenient.  Discover
parses C++, builds an AST, and allows you to walk through it using Tcl
scripts. It also works with Java and C. It is highly scalable, has nice
GUIs, works on NT and most flavors of UNIX, and is generally quite cool.

Unfortunately DISCOVER is also rather expensive, but maybe you could
convince them to give out an academic license.  Also, getting it to parse
large bodies of code is a non-trivial exercise, as the 'project definition
files' are kind of quirky--there is a GUI to do this as well, but it takes
some practice.

They call the technology 'Tree Pattern Matching'.  Essentially you write
(or use the gui to generate) a big ugly Tcl representation of an AST, and
then do a search and replace on it. From this description, DISCOVER can
re-generate your code; the actual process is quite fast, though DISCOVER
is an awful memory hog.

See: 
http://www.setech.com/products/TPMart.html
http://www.setech.com/products/engineer_desc.html#tpm
(Note: this website was written by marketing people and may be somewhat
out of date.)

Disclaimer:
I used to work for the company and own a trivial amount of worthless stock
in it.

-Greg-






On Thu, 17 Feb 2000, Mihai Christodorescu wrote:

> Hi!
> 
> 	I am looking for a simple tool that would allow me to perform program
> transformations (from source to source), on C, C++, and Java. The
> transformations I am thinking of are (mostly) orthogonal to existing code,
> such as:
> 
> * insert the code:
> 	printf( "<function name>\n" );
>   at the beginning of each function in the source file
>   or at the exit point(s) of each function in the source file
> 
> The tool would preferably be a library for reading in the source to some
> kind of AST which I can process/modify and dump to output. Or maybe a tool
> similar to Yacc/bison, that comes with grammars that build ASTs (there
> should be something like this out there, after 20+ years of PL research!)
> 	I am not looking for efficiency, but rather ease of use (of course, if it
> takes 2 hours to run the transforming program on some input source file,
> then it is no good).
> 	To this effect, I found something called SAGE++. Before I delve in it, I
> would like to ask you whether you know of any other tools for source code
> transformation, that parse C, C++, and Java, and are accessible from C, C++,
> or Java (i.e. a tool written in Lisp is nice, but not useful to me, for
> now!).
> 
> Thanks,
> 
> Mihai
> 
> PS. BTW, does anyone know of a yacc/bison C++ grammar? I was told that C++
> is not easily yacc-able due to ambiguities in its definition...
> 
> -- 
>  Mihai Christodorescu -=- mihai@xxxxxxxxxxx - http://www.cs.wisc.edu/~mihai
> .---------------------------------------------------------------------------
> |   The man of knowledge must be able not only to love his enemies but also
> | to hate his friends.                                - Friedrich Nietzsche
> `---------------------------------------------------------------------------
> PGP signature block might follow.
> 
> -----BEGIN PGP MESSAGE-----
> Version: PGPfreeware 5.0i for non-commercial use
> MessageID: tVqftY/8ui9OxE19q1SsdUz8y4jjvpPv
> 
> owGtVT2PHEUQPRnZ0nWAIIC47oTELjs7a9myZB0fxpxs45OBE7cSQhDQ29Oz09qZ
> 7lF3j4dFQE7Oh5BsQUaASSC5hISQhAAJRIbgF/APeNWzPmMcQOBJdra7uurVe696
> Ptq69MjprYt3bn3/+flv//rqVnPq8VNnnt764srZ7y5cPPjg9o9/rp7MiuOrrz/1
> 6SdbX/6y+/XHb905f9s89tvPT3z20x8HP6yOvznz6+J0iIWxx49e+F28bHaE2L5O
> sqHauZWxSyqdJ0nBNG2tKTpXU6xkpN51dUGyrl1PDW9Qqz1iG2q9W3rZiOilDbwi
> o3E20Kj0rqHgOq9S/PA2zshZ2s9ofzLJSNqCDuRNmdO80g9kSLhiZWwC5kqSXtOo
> cSHW6zE5Hyu3dFbWnF2/a0LkMOUKnYnQqYpk2BPiGTI2aB+RSKfNPbHdemNjOaLd
> 58rOKi5GVjb6hbftLo2fFURyCF/opbF2U1xLpDyJNzZFbNorTa1xjKkbTgJOpNah
> zCiM/9dpMa82fA9Ut16X2stFvQYMKFKbhZd+nfTxWhaM6v40ieNGC7BVcMnLR3Pq
> K4O610lJy0IpHcKscYUp14n7omtaPue62HYxp9c8NXKd6jEUARuYWnoOeVMqNVuY
> 4GxGyREKtQL1JlbE+jfSh2Fj0RngR3V4APC8FqFKLS0YaqNZ0SX6WQFyZQIX5za8
> hh/KqD2dOzuhteZ86OLwBtoN+KeqnfHGq9bF+/yqy9Ioo61aZ6geyUvOB86D5hQd
> fkb4VeApoIopyUQR5Qr4z1HFq9yh7wY6T2zI6TfuZtMydlAOou4yzsJlAmegaCS0
> Yh0tnSvGudieu6E7YNMqZtCgdB0ov8eAwjTpgo4uX7symeT0kkZNjbhC1ze5EHLi
> mBjsMNDl4OkVrV0HYXXqkd9XFkOJ/qRdk0urLF5I1GyQsvH/NV8bGVvwrB8YyOGN
> 5w2ywzRmgdsgDfQmUiA3B9LI5Drf+IV6b2JkNizdMKFNlBilB1VYNUhRdmlgG6wC
> iwD2HfAF+0u7CpkQr5hKGiEOj0DJ/I2MCgeZ0Jqz+l6ntD6xI8O568BLoK+XrCYo
> S+1hUyRhItvBYJr45FRyP0U3UNoszLIz0aBOYj1AgtJYwyzlObBNpyQo4aL9yuOi
> cQWkCqqj6fNTanjjRRXy3gSV6wKrVMXY7s1mfd/n/9iYfZhiRT59eI94n4hvTwyu
> ZWqYIthqiYUuxHR3cK9MgLNoHw3XDv5K3rS64a5ZHVkHh1zYBm3DdukxU0XI6T+e
> KV1FZOH5qnnV6PheULjN3xnwPZRHHF47xDdpaWXs4MlF7dQKvC+rCA/xNykXfwM=
> =c7J4
> -----END PGP MESSAGE-----
> 
> 
> 

Gregory R. Bronner
Department of Computer Science
UW-Madison
gbronner@xxxxxxxxxxx





[← Prev in Thread] Current Thread [Next in Thread→]
  • Re: Simple source translation tool? (fwd), Gregory R. Bronner <=