Many kinds of transformations of a program are possible:
- Optimization of various kinds. Low-level inefficiencies created
by a program generation system can be removed.
- Specialization. Generic operations or program patterns can
be specialized to the form needed for a specific implementation
of an abstract data structure. OOP methods can be specialized for
- Language translation. Transformations can change code into the
syntax of the target language.
- Code expansion. Small amounts of input code can be transformed
into large amounts of output code. The expansion can depend on
specifications that are much smaller than the final code.
- Partial evaluation. Things that are constant at compile time
can be evaluated and eliminated from code.
- Changing recursion to iteration
- Making code more readable
- Making code less readable ( code obfuscation)