FermaT Transformation System
Encyclopedia
The FermaT Transformation System is an industrial strength program
transformation system targeted at reverse engineering, program comprehension
and migration between programming languages. The system is currently being
used to translate IBM 370 Assembler modules into equivalent readable and
maintainable C and COBOL programs.

FermaT is available as free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

 under the GNU General Public License (GPL).

A program transformation
Program transformation
A program transformation is any operation that takes a computer program and generates another program. In many cases the transformed program is required to be semantically equivalent to the original, relative to a particular formal semantics and in fewer cases the transformations result in programs...

 is any operation which changes the text
of a program without changing its external behaviour. A simple example
is reversing the arms of an IF statement:


IF x = 0 THEN y := 1 ELSE y := 2 FI

is semantically equivalent to:

IF x <> 0 THEN y := 2 ELSE y := 1 FI


A more complex example of a program transformation is Semantic Slicing. Consider the following WSL program:


total:= 0;
i := 0;
evens := 0;
noevens := 0;
odds := 0;
noodds := 0;
n := n0;
WHILE i <= n DO
evenflag := A[i] MOD 2;
evenflag := 0;
IF FALSE
THEN evens := evens + A[i];
noevens := noevens + 1
ELSE odds := odds + A[i];
noodds := noodds + 1 FI;
total := total + A[i];
i := i + 1 OD;
IF noevens <> 0
THEN meaneven := evens/noevens
ELSE meaneven := 0 FI;
IF noodds <> 0
THEN meanodd := odds/noodds
ELSE meanodd := 0 FI;
mean := total/(n+1);
evendifference := ABS(meaneven - mean);
odddifference := ABS(meanodd-mean)


Suppose we are interested in the final value of the variable evendifference. Save the program as a text file test-1.wsl and run the transformation:


dotrans test-1.wsl test-2.wsl Semantic_Slice data=evendifference


This generates the output file test-2.wsl:


evendifference
:= ABS(REDUCE("+", A[0..n0]) / (n0 + 1))


See this paper for more information about semantic slicing.

Download FermaT here
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK