Rust ecosystem for FlatPPL, the Flat Portable Probabilistic Language.
FlatPPL is a minimal, inference-agnostic stochastic language for specifying probabilistic models.
This monorepo is a Cargo workspace; member crates live under crates/:
flatppl-core— the in-memory IR (extended-FlatPIR model)flatppl-syntax— canonical FlatPPL surface syntax: parse + printflatppl-flatpir— FlatPIR S-expression reader + writerflatppl-infer— type, shape, and phase inferenceflatppl-hs3— HS3 / pyhf → FlatPPL importerflatppl-fileaccess— resolve asource(local path orhttp/httpsURL) to a local file, with the shared remote-content cache (native host layer)flatppl-cli— theflatpplcommand-line driverflatppl-lsp— FlatPPL language server (diagnostics, hover, go-to-definition, completion)
See ARCHITECTURE.md for the design and the road ahead.
Requires a Rust toolchain (≥ 1.85, e.g. via rustup). The crates are not published to crates.io yet; install the CLI straight from the repository:
cargo install --git https://github.com/flatppl/flatppl-rust flatppl-cliThis places a flatppl binary on your Cargo bin path:
flatppl convert model.flatppl model.flatpir # FlatPPL → FlatPIR
flatppl convert model.flatpir model.flatppl # FlatPIR → FlatPPL
flatppl convert messy.flatppl tidy.flatppl # canonicalize (same format)
flatppl infer model.flatppl typed.flatpir # emit type/phase-annotated FlatPIR
flatppl infer --level=phase m.flatppl m.flatpir # or: type, valueset, normalization, shape
flatppl prepare model.flatppl # fetch the model's remote deps into the cacheFormats are inferred from the file extensions. FlatPPL output uses the full
surface syntax (operators, indexing, lambdas, :=); pass --syntax minimal
for the lowered function-call form instead.
Inputs are local files. A model may load_module remote (http/https)
dependencies, but the command input itself is always a local path — like
cargo build on a local crate. convert and infer are local and offline:
they resolve dependencies from a shared local cache only and never touch the
network. To populate that cache, run flatppl prepare <model> — the one
command that downloads a model's transitive remote dependencies (recursively,
relative URLs resolved against their importing file). flatppl prepare --update
refreshes already-cached deps. Cache location and trust are env-controlled
($FLATPPL_CACHEDIR; an untrusted URL prompts interactively and is refused in
non-interactive use unless FLATPPL_TRUST=1).
git clone https://github.com/flatppl/flatppl-rust
cd flatppl-rust
cargo build --workspace # build all crates
cargo test --workspace # run all test suites
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all
cargo run -p flatppl-cli -- convert model.flatppl model.flatpir