encyclopegia.org

A-normal form

In computer science, A-normal form (abbreviated ANF, sometimes expanded as administrative normal form or as atomic normal form) is an intermediate representation of programs in functional programming language compilers.[src] In ANF, all arguments to a function must be trivial (constants or variables).[src] That is, evaluation of each argument must halt immediately.[src] ANF was introduced by Sabry and Felleisen in 1992 as a simpler alternative to continuation-passing style (CPS).[src] Some of the advantages of using CPS as an intermediate representation are that optimizations are easier to perform on programs in CPS than in the source language, and that it is also easier for compilers to generate machine code for programs in CPS.[src] Flanagan et al.[src] 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.[src]

In computer science, A-normal form (abbreviated ANF, sometimes expanded as administrative normal form or as atomic normal form) is an intermediate representation of programs in functional programming language compilers.[src] In ANF, all arguments to a function must be trivial (constants or variables).[src] That is, evaluation of each argument must halt immediately.[src] ANF was introduced by Sabry and Felleisen in 1992 as a simpler alternative to continuation-passing style (CPS).[src] Some of the advantages of using CPS as an intermediate representation are that optimizations are easier to perform on programs in CPS than in the source language, and that it is also easier for compilers to generate machine code for programs in CPS.[src] Flanagan et al.[src] 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.[src] ==Grammar== Consider the pure λ-calculus with constants and let-expressions.[src] The ANF restriction is enforced by allowing only values (variables, constants, and λ-terms), to serve as operands of function applications, and requiring that the result of a non-trivial expression (such as a function application) be immediately captured in a let-bound variable.[src] 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.[src] ==Examples== The expression: f(g(x),h(y)) is written in ANF as: let v0 = g(x) in let v1 = h(y) in f(v0,v1) By imagining the sort of assembly this function call would produce: ;; let v0 = g(x) move x into args[0] call g move result into temp[0] ;; let v1 = h(y) move y into args[0] call h move result into temp[1] ;; f(v0, v1) move temp[0] into args[0] move temp[1] into args[1] call f 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.[src]

18 sentences · 18 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"A-normal form." encyclopegia.org, 2024, https://encyclopegia.org/wiki/a-normal-form. Accessed 29 November 2026.

Chicago

"A-normal form." encyclopegia.org. Accessed November 29, 2026. https://encyclopegia.org/wiki/a-normal-form.

APA

encyclopegia.org. (2024). A-normal form. Retrieved November 29, 2026, from https://encyclopegia.org/wiki/a-normal-form

Accessed November 29, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Form I-94

stub · references available

Ab-normal Beauty

stub · references available

quadratic form

stub · references available

curvature form

stub · references available

modular form

stub · references available
CC BY-SA 4.0 · tier1-factual · https://en.wikipedia.org/w/index.php?oldid=1261719327 · 0.55 · snapshot a-normal-form-531324-f6da7de8efb7990f · QID Q4646997

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.