Expand description
Auto-generated module
🤖 Generated with SplitRS
Traits§
- Lcnf
Folder - Bottom-up transformation trait (folder).
- Lcnf
MutVisitor - Mutable visitor trait for in-place mutation of LCNF expressions.
- Lcnf
Visitor - Immutable visitor trait for LCNF expressions.
Functions§
- all_
vars - Collect all variable IDs appearing in an expression (free + bound).
- alpha_
equiv - Check structural equality up to variable renaming (alpha-equivalence).
- bound_
vars - Collect all let-bound variable IDs in an expression.
- check_
anf_ invariant - Check that the ANF invariant holds: all arguments are atomic.
- compute_
inline_ cost - Compute a heuristic inlining cost for a function declaration.
- count_
allocations - Estimate the number of heap allocations (from constructor applications).
- count_
branches - Count the number of case splits in an expression.
- definition_
sites - Collect all definition sites in an expression.
- estimate_
runtime_ cost - Estimate the runtime cost of an expression under the given cost model.
- expr_
depth - Compute the maximum nesting depth of an expression.
- expr_
size - Count the number of AST nodes in an expression.
- flatten_
lets - Flatten nested let chains.
- free_
vars - Collect all free variable IDs in an expression.
- hoist_
lets - Hoist let bindings out of case branches when the same binding appears in all branches.
- inline_
let - Inline a single let binding by substituting its value into all uses.
- is_
linear - Check whether all variables are used at most once.
- pretty_
print_ expr - Pretty-print an expression to a string.
- pretty_
print_ fun_ decl - Pretty-print a function declaration.
- pretty_
print_ module - Pretty-print an entire module.
- remove_
unused_ lets - Remove unused let bindings (dead code elimination).
- rename_
vars - Rename variables according to the given mapping.
- simplify_
trivial_ case - Simplify a case with a single alternative into a let chain.
- substitute_
arg - Apply a substitution to an argument.
- substitute_
expr - Apply a substitution to an expression.
- substitute_
let_ value - Apply a substitution to a let-bound value.
- usage_
counts - Count how many times each variable is referenced in an expression.
- validate_
expr - Validate an expression with respect to a set of bound variables.
- validate_
fun_ decl - Validate a function declaration.
- validate_
module - Validate an entire module, collecting all errors.
- walk_
alt - Recursively walk children of a case alternative.
- walk_
alt_ mut - Walk children of a case alternative mutably.
- walk_
expr - Recursively walk children of an expression.
- walk_
expr_ mut - Walk children of an expression mutably.
- walk_
fun_ decl - Recursively walk children of a function declaration.
- walk_
fun_ decl_ mut - Walk children of a function declaration mutably.
- walk_
let_ value - Recursively walk children of a let-bound value.
- walk_
let_ value_ mut - Walk children of a let-bound value mutably.
Type Aliases§
- NameMap
- Mapping from original names to mangled LCNF names.