The *(topic) of *(metaprogramming) techniques that act on whole programs, which also encompasses _(code generation|Code Generation) and _(optimization|optimize).
The primary resource on this is _(Program-Transformation.Org).

<ul class="links">
<li>The classical, often cited in program transformation papers, <em>fold/unfold framework</em> by Burstall & Darlington:
<ul>
<li>The original paper (1977), scanned (.pdf) _(A Transformation System for Developing Recursive Programs| http://www.diku.dk/forskning/topps/activities/pgmtrans/burstall.pdf) (archived also at _("CiteSeer" | http://citeseer.nj.nec.com/burstall77transformation.html))
<li>A note (.ps): _("Unfold/Fold Transformation"| http://www.diku.dk/topps/activities/pgmtrans/unfold-fold.ps).
</ul>
<li>_(A Comparative Revisitation of Some Program Transformation Techniques| http://citeseer.nj.nec.com/pettorossi96comparative.html).
<li>See also _(A taxonomy of program transformers).
</ul>

A list of program transformation techniques and tools:

/("program transformation" :attribute :topic :match :exact)