A program transformation is (a usually mechanical) process to modify one program to produce another.
A program transformation is any process that converts a program into another program. They are used to optimize programs, or to translate them to other languages, or to make mass changes to support evolution.
That process may be a manual process, but generally are thought of as automated actions. These actions can be implemented procedurally (as is the case with most compilers and code generators) or with source-to-source transformations, which use pairs of source code patterns to describe the before and after states of code fragments.
Program transformation includes the following as special cases: refactoring, aspect-oriented programming, code generation and compilation.