source-transformation(也常写作 source transformation)指对源代码(source code)进行变换/改写的过程:在尽量保持程序语义不变的前提下,改变代码结构、表达方式或抽象层级,以达到优化、移植、自动生成代码、重构或为后续编译步骤做准备等目的。常见相关说法是 source-to-source transformation(源到源变换)。
/ˈsɔːrs ˌtrænsfərˈmeɪʃən/
The compiler performs source-transformation before generating machine code.
编译器在生成机器码之前会先进行源代码变换。
Through source-transformation, the tool rewrites the program to a safer style while preserving its original behavior.
通过源代码变换,该工具在保持原有行为不变的情况下,把程序改写成更安全的风格。
该词由 source(来源;此处指“源代码”) + transformation(变换、转换)构成。transformation 源自拉丁语 transformare(“改变形状/形式”),在计算机领域引申为对程序表示(尤其是源代码文本或抽象语法树)进行系统性的“改写”。