Module mz_transform::normalize

source ·
Expand description

Normalize the structure of Let and LetRec operators in expressions.

Normalization happens in the context of “scopes”, corresponding to

  1. the expression’s root and 2. each instance of a LetRec AST node.

Within each scope,

  1. Each expression is normalized to have all Let nodes at the root of the expression, in order of identifier.
  2. Each expression assigns a contiguous block of identifiers.

The transform may remove some Let and Get operators, and does not introduce any new operators.

The module also publishes the function renumber_bindings which can be used to renumber bindings in an expression starting from a provided IdGen, which is used to prepare distinct expressions for inlining.

Structs

Install replace certain Get operators with their Let value.