Tiny f64 math facade that works on both the default (std)
build and the no_std opt-in. core::f64 doesn’t expose
sqrt / sin / cos / etc. — those methods live in
std::f64’s platform-dependent math library — so the no_std
build has to forward to the pure-Rust libm crate instead.
The std build stays dep-free and calls the native f64
methods directly.
“Did you mean?” suggestions — used by error paths to turn
Variable lenght not found into a hint that points at
length (or len) when those exist in the surrounding
scope.
Persistent state for an interactive REPL session. Unlike
the one-shot run / [Evaluator::run] pair, a
ReplSession carries its scopes, fns, user types, method
tables, and import cache across calls, so
session.eval("let x = 5") followed by
session.eval("print(x)") sees the same x.
Persistent state for an interactive REPL session. Build
once with Self::new, then call Self::eval for each
fresh line / block the user types. State carried across
calls: every let / const / fn / struct / enum /
method declaration, every use’d module’s bindings and
aliases, the global rng seed, and the import cache.
Parse Bop source and run the static check pass, returning
both the AST and any non-fatal warnings (currently:
match-exhaustiveness). Prefer this over parse in tools
that surface diagnostics to users — the CLI uses it to
print warnings before running the program.
Like parse_with_warnings but follows every top-level
use statement via the supplied resolver so the
exhaustiveness check can see imported enums. resolver
has the same shape as BopHost::resolve_module.
The core pattern matcher. Re-exported so engines beyond the
tree-walker (the bytecode VM, the AOT runtime) can apply the
same structural rules without re-implementing them.
Attempt to match pattern against value. On success, appends
any captured (name, Value) bindings to bindings and returns
true; on failure, returns false and leaves bindings in an
undefined state — it’s the caller’s responsibility to discard it.
Shared scope walker for resolving source-level type
references to the declaring module. Re-exported because VM
and AOT both need to build per-frame type resolvers when
calling pattern_matches — the identity comparison lives
on the matcher side, but the scope lookup is identical
across engines.
Walk a pair of scope stacks to resolve a source-level type
reference — the same logic as
[Evaluator::resolve_type_ref], but free-standing so the
pattern matcher can be called with a borrow of the
evaluator’s tables without needing the evaluator itself.
Returns None if the name isn’t in scope.
Type alias for the resolver closure pattern_matches expects.
Resolver that turns a source-level type reference — optional
namespace plus bare name (m.Color vs plain Color) — into
the declaring module’s path. Pattern matching threads this
through so a pattern like Color::Red only matches values
whose module identity agrees with the current scope’s binding
of Color.