caelum0x 7a06febeb6 chore(release): inherit repository metadata on all crates
Crates inherited version/license/edition from [workspace.package] but not
`repository`, so every crate published without a repository link. Add
`repository.workspace = true` uniformly, completing the
description+version+license+repository metadata `cargo publish` and crates.io
expect. No build impact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-06 13:08:47 +03:00
..
2026-08-16 21:04:23 +03:00
2026-08-16 21:04:23 +03:00
2026-08-16 21:04:23 +03:00

lawsynth-expr

Language-neutral scalar expression IR with a deterministic parser, printer, evaluator, and local simplification primitives. It is used by world laws and feature libraries; expression evaluation is pure and accepts values only through an explicit environment.

Use

use lawsynth_core::Identifier;
use lawsynth_expr::{Environment, evaluate, parse, print};

let expression = parse("rate * population - loss")?;
let environment = Environment::from([
    (Identifier::new("rate")?, 0.2),
    (Identifier::new("population")?, 10.0),
    (Identifier::new("loss")?, 1.0),
]);
assert_eq!(evaluate(&expression, &environment)?, 1.0);
assert_eq!(print(&expression), "rate * population - loss");
# Ok::<(), Box<dyn std::error::Error>>(())

Parsing rejects malformed syntax and evaluation rejects missing symbols and non-finite results. The crate represents scalar arithmetic only; dimensional checking belongs to lawsynth-units, while equivalence saturation belongs to lawsynth-egraph.