Go to file
2026-07-08 23:41:26 +09:00
crates Expose tokenizer for web highlighting 2026-07-08 19:50:04 +09:00
doc/manual/souce Add canonical grammar and CodeMirror playground 2026-07-08 23:41:26 +09:00
editors Add canonical grammar and CodeMirror playground 2026-07-08 23:41:26 +09:00
examples Make decodal the published library crate 2026-06-25 22:51:16 +09:00
site/decodal-site Add canonical grammar and CodeMirror playground 2026-07-08 23:41:26 +09:00
.envrc Set up Cargo and Nix project 2026-06-16 01:46:49 +09:00
.gitignore Migrate documentation site to Astro 2026-06-17 00:22:32 +09:00
Cargo.lock Expose derive macro behind feature 2026-06-26 00:59:39 +09:00
Cargo.toml Add typed Decodal derive support 2026-06-26 00:39:33 +09:00
devshell.nix Add Svelte docs site and WASM playground 2026-06-17 00:07:11 +09:00
flake.lock Set up Cargo and Nix project 2026-06-16 01:46:49 +09:00
flake.nix Set up Cargo and Nix project 2026-06-16 01:46:49 +09:00
LICENSE-APACHE Prepare crates.io release metadata 2026-06-25 22:25:01 +09:00
LICENSE-MIT Prepare crates.io release metadata 2026-06-25 22:25:01 +09:00
package.nix Add typed Decodal derive support 2026-06-26 00:39:33 +09:00
README.md Expose derive macro behind feature 2026-06-26 00:59:39 +09:00

Decodal

Decodal is a small deterministic DSL for describing, composing, validating, and materializing structured data.

It is designed around a lightweight Rust library:

  • host-supplied imports through SourceLoader
  • no filesystem access in the library core
  • concrete and abstract values with constraints and defaults
  • deterministic expression evaluation
  • optional regex support behind a Cargo feature
  • browser playground support through WebAssembly

Library crate

Embedded hosts should depend on decodal and provide imports with a SourceLoader.

[dependencies]
decodal = "0.1"

Derive support

For embedded Rust applications, Decodal can generate a schema and typed decoder from a Rust struct with the derive feature.

[dependencies]
decodal = { version = "0.1", features = ["derive"] }
use decodal::{Decodal, DecodalDecode, DecodalSchema, Engine};

#[derive(Decodal)]
struct Service {
    name: String,
    #[decodal(gt = 443, default = 8443)]
    port: i64,
    #[decodal(rename = "feature.enable", default = true)]
    feature_enabled: bool,
}

The derive implements:

  • DecodalSchema, which produces a host schema for Engine::bind_global
  • DecodalDecode, which converts materialized Data into the Rust struct

CLI

A standalone CLI is kept in this repository as the decodal-cli workspace package. It builds a decodal binary, but it is not the primary crates.io package.

Run a Decodal file from the repository:

cargo run -q -p decodal-cli -- examples/advanced/main.dcdl

Enable optional regex support when needed:

cargo run -q -p decodal-cli --features regex -- examples/regex/main.dcdl

Web playground

The static documentation site and browser playground live under:

site/decodal-site/

License

Licensed under either of:

  • Apache License, Version 2.0
  • MIT license

at your option.