FermaT Transformation System
|This article needs additional citations for verification. (April 2016) (Learn how and when to remove this template message)|
||The topic of this article may not meet Wikipedia's general notability guideline. (April 2016) (Learn how and when to remove this template message)|
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.
A program transformation 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.
|This programming-tool-related article is a stub. You can help Wikipedia by expanding it.|