[package]
name = "noise-core"
edition.workspace = true
version.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"
description = "Core of the Noise probabilistic language: lexer, parser, evaluator, sampler."
keywords = ["probabilistic", "monte-carlo", "language", "interpreter", "sampling"]
categories = ["science", "mathematics", "compilers"]

[dependencies]
cranelift = { version = "0.127.4", optional = true }
cranelift-jit = { version = "0.127.4", optional = true }
cranelift-module = { version = "0.127.4", optional = true }
cranelift-native = { version = "0.127.4", optional = true }
wasm-encoder = "0.252"

# Browser-only: the WASM-emitter's host seam (`wasm_host`) calls into JS (`WebAssembly.instantiate`
# the emitted kernel + run it) via wasm-bindgen. Native builds never compile that module, so this
# dependency is wasm32-gated and keeps the native crate wasm-bindgen-free.
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"

[dev-dependencies]
criterion = { version = "0.5", default-features = false, features = ["cargo_bench_support"] }
wasmi = "1.1"

# Sampler throughput benchmarks (Phase 4 baseline). `harness = false` hands the binary to
# Criterion. Run with `cargo bench -p noise-core`.
[[bench]]
name = "sampling"
harness = false

[features]
# Native Cranelift JIT backend (Phase 4 "B"). Off by default so the crate stays WASM-clean and
# dependency-light; enable with `--features jit` on a native target. Falls back to the columnar
# interpreter for any graph it can't yet emit, so it never changes results.
jit = ["dep:cranelift", "dep:cranelift-jit", "dep:cranelift-module", "dep:cranelift-native"]
