Skip to main content

Module functions

Module functions 

Source
Expand description

Auto-generated module

🤖 Generated with SplitRS

Traits§

LcnfFolder
Bottom-up transformation trait (folder).
LcnfMutVisitor
Mutable visitor trait for in-place mutation of LCNF expressions.
LcnfVisitor
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.