Expand description
§panproto-expr
A pure functional expression language for panproto enriched theories.
This crate provides the computational substrate for schema transforms: coercion functions, merge/split logic, default value computation, and conflict resolution policies. Expressions are:
- Pure: no IO, no mutable state, no randomness
- Deterministic: same inputs always produce the same output
- Serializable: the
Exprenum derivesSerialize/Deserialize - Platform-independent: evaluates identically on native and WASM
- Bounded: step and depth limits prevent runaway computation
The language is lambda calculus with pattern matching, records, lists, and ~50 built-in operations on strings, numbers, and collections.
Modules§
- typecheck
- Lightweight type inference for expressions.
Structs§
- Env
- An evaluation environment mapping variable names to values.
- Eval
Config - Configuration for the expression evaluator.
Enums§
- Builtin
Op - Built-in operations, grouped by domain.
- Expr
- An expression in the pure functional language.
- Expr
Error - Errors that can occur during expression evaluation or type-checking.
- Expr
Type - Simple type classification for expressions.
- Literal
- A literal value in the expression language.
- Pattern
- A destructuring pattern for match expressions.
Functions§
- apply_
builtin - Apply a builtin operation to evaluated arguments.
- eval
- Evaluate an expression in the given environment.
- free_
vars - Collect all free variables in an expression.
- pattern_
vars - Collect all variable names bound by a pattern.
- substitute
- Apply capture-avoiding substitution: replace
namewithreplacementinexpr.