A program transformation is an action that changes one program into another. The term program transformation is also used to describe an algorithm that performs program transformation(s). More generally, a set of program transformations map a structure described in one formal system (source) into a structure described in another formal system (target):

program-transformation: source -> target

The research field spawned from classical syntax-directed compiler optimisations and has over time evolved into the study- and development of formally well founded semantics based methods. Related areas of research is program analysis, semantics based generation of compilers and abstract machines (by a.o. partial evaluation), and generative programming. The proceedings of the Partial Evaluation and Program Transformation Day [1] presents the state of the art of the field.

A simple example of a (c# source to c# source) program transformation is the following:

class c { void m( ) { string s; s = "foo"; Console.Write ( s ); } }
transformed to (assigning a value to s upon declaration):

class c { void m( ) { string s = "foo"; Console.Write ( s ); } }

It is common to differentiate between semantics- (or correctness-) preserving transformations and -changing transformations. The example above is semantics preserving. Also, program transformations can be categorized as being either syntax- or semantics based. A team of computer scientists based at DIKU used the former to create a tool that makes COBOL programs year 2000 compliant; an example of semantics changing transformations [2].

[1]
Robert Glück and Yoshihiko Futamura, Partial Evaluation and Program Transformation. Proceedings, Institute for Software Production Technology, Waseda University, Tokyo (2000).
[2]
Peter Harry Eidorff et al, AnnoDomini: From Type Theory to a Year 2000 Conversion Tool, PROGRAMMING LANGUAGE TECHNOLOGIES, 36, (1999), http://www.ercim.org/publication/Ercim_News/enw36/sorensen.html.
Back to the Glossary of Generative Programming Terms
Back to the course home page
Contributor: Morten M. Holst
Last modification: 3/2-2005