Skip to main content

lower

Function lower 

Source
pub fn lower(pattern: &Pattern) -> Program
Expand description

Lower a parsed pattern into its three-address representation.

This is total for every Pattern that satisfies the AST invariants, which parse guarantees. The result always satisfies Program::validate.

Each n-ary chain node becomes the left-associative chain of binary operations it stands for, so a OR b OR c lowers to Or(Or(a, b), c).

ยงPanics

If a chain node has no operands. This can only happen in hand-built or deserialized Patterns that violate the AST invariants.