2.6 KiB
Introduction
Decodal is the Deferred Constraint Data Language, abbreviated DCDL.
Its source files use the .dcdl extension.
Decodal is a language for describing configuration values, schemas, constraints, and derived configuration in one expression system, producing validated structured data.
Purpose
In conventional configuration systems, values, schemas, defaults, derived settings, and validation are often handled by separate mechanisms. Decodal treats them as composable expressions.
Port = Int & >= 1 & <= 65535;
Service = {
host = String;
port = Port default 8080;
};
Config = {
host = "127.0.0.1";
port = 8000;
} as Service;
Service describes a range of accepted values.
Each value in Config is validated against Service, while ranges that exist only in Service remain abstract in the result.
During materialization, explicit values take precedence and default supplies values for ranges that remain unspecified.
Core concepts
- Values and constraints are expressions that can be referenced and composed in the same way.
&performs symmetric composition and preserves constraints from both sides.asverifies that the left side is more specific and narrower than the right side, then combines them.//performs a right-biased structural patch, including overrides.defaultis not a constraint. It is a fallback selected only during materialization.- Object fields, function arguments, and imports are evaluated when they are needed.
Unknownis the top range that accepts any concrete value, but it cannot be materialized while it remains abstract.
Scope
Decodal is specialized for describing configuration, schemas, constraints, and derived data.
General-purpose state mutation, time, randomness, network access, and try / catch for treating errors as values are not language features.
The host provides filesystem and external-format access. Given the same source, import results, and global bindings, Decodal evaluation is deterministic.
Regular-expression constraints depend on the runtime's regex feature.
Decodal does not provide advanced type inference, exhaustiveness checking for match, or static detection of unreachable branches.
Continue reading
- Language Specification: syntax, values, expressions, constraints, evaluation, and materialization.
- Embedding: Rust and JavaScript execution, host environments, structured imports, and language services.
- Packages and Integrations: crates and JavaScript packages for each use case.