Abstract syntax tree transformation (source code)

= Abstract syntax tree transformation

An <abstract syntax tree> transformation replaces or rearranges nodes. It can simplify a <program expression>, insert instrumentation, or translate a language construct into simpler constructs. When intended to preserve <programming language semantics>, it must preserve the relevant observable behavior, including values, <side effects>, and failures. A changed tree can be structurally valid while changing the program's meaning.