A-normal form

In ANF, all arguments to a function must be trivial (constants or variables).

ANF was introduced by Sabry and Felleisen in 1992[1] as a simpler alternative to continuation-passing style (CPS).

Flanagan et al.[2] showed how compilers could use ANF to achieve those same benefits with one source-level transformation; in contrast, for realistic compilers the CPS transformation typically involves additional phases, for example, to simplify CPS terms.

The ANF restriction is enforced by The following BNF grammars show how one would modify the syntax of λ-expressions to implement the constraints of ANF: Variants of ANF used in compilers or in research often allow records, tuples, multiargument functions, primitive operations and conditional expressions as well.

The expression: is written in ANF as: By imagining the sort of assembly this function call would produce: One can see the immediate similarities between ANF and the compiled form of a function; this property is a part of what makes ANF a good intermediate representation for optimisations in compilers.