Skip to main content

Crate panproto_expr

Crate panproto_expr 

Source
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 Expr enum derives Serialize/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.
EvalConfig
Configuration for the expression evaluator.

Enums§

BuiltinOp
Built-in operations, grouped by domain.
Expr
An expression in the pure functional language.
ExprError
Errors that can occur during expression evaluation or type-checking.
ExprType
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 name with replacement in expr.