|
|
|
@@ -1,163 +1,6 @@
|
|
|
|
|
---
|
|
|
|
|
import ManualLayout from '../layouts/ManualLayout.astro';
|
|
|
|
|
import { highlightCode } from '../lib/highlight.js';
|
|
|
|
|
|
|
|
|
|
const example = `let
|
|
|
|
|
Port = Int & >= 1 & <= 65535;
|
|
|
|
|
Service = {
|
|
|
|
|
host = String;
|
|
|
|
|
port = Port default 8080;
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
host = "127.0.0.1";
|
|
|
|
|
} as Service;`;
|
|
|
|
|
|
|
|
|
|
const result = `{
|
|
|
|
|
"host": "127.0.0.1",
|
|
|
|
|
"port": 8080
|
|
|
|
|
}`;
|
|
|
|
|
import HomePage from '../components/HomePage.astro';
|
|
|
|
|
import '@fontsource/ibm-plex-sans-jp/latin-400.css';
|
|
|
|
|
import '@fontsource/ibm-plex-sans-jp/latin-600.css';
|
|
|
|
|
---
|
|
|
|
|
<ManualLayout
|
|
|
|
|
title="Decodal — Deferred Constraint Data Language"
|
|
|
|
|
description="Decodal is a deterministic data language for describing, composing, validating, and materializing structured data."
|
|
|
|
|
frontpage
|
|
|
|
|
>
|
|
|
|
|
<section class="home-intro" aria-labelledby="home-title">
|
|
|
|
|
<div class="home-intro-copy">
|
|
|
|
|
<h1 id="home-title">Configuration, constraints, and defaults are values.</h1>
|
|
|
|
|
<p class="home-lead">
|
|
|
|
|
Decodal is a small deterministic language for describing, composing, validating, and materializing
|
|
|
|
|
structured data. The same expression can carry concrete data and the range that data must satisfy.
|
|
|
|
|
</p>
|
|
|
|
|
<div class="home-actions">
|
|
|
|
|
<a class="button primary" href="/playground/">Open the playground</a>
|
|
|
|
|
<a class="text-action" href="/docs/introduction/">Read the introduction <span aria-hidden="true">→</span></a>
|
|
|
|
|
</div>
|
|
|
|
|
<dl class="home-facts">
|
|
|
|
|
<div>
|
|
|
|
|
<dt>Source</dt>
|
|
|
|
|
<dd><code>.dcdl</code></dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<dt>Runtime</dt>
|
|
|
|
|
<dd>Rust · WebAssembly</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<dt>Output</dt>
|
|
|
|
|
<dd>Validated structured data</dd>
|
|
|
|
|
</div>
|
|
|
|
|
</dl>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="home-code" aria-label="Decodal example and materialized result">
|
|
|
|
|
<div class="code-caption">
|
|
|
|
|
<span>service.dcdl</span>
|
|
|
|
|
<span>DCDL</span>
|
|
|
|
|
</div>
|
|
|
|
|
<pre class="code-block"><code class="language-dcdl" set:html={highlightCode(example, 'dcdl')} /></pre>
|
|
|
|
|
<div class="materialized-result">
|
|
|
|
|
<span>materialize</span>
|
|
|
|
|
<pre><code>{result}</code></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="home-section" aria-labelledby="model-title">
|
|
|
|
|
<header class="section-heading">
|
|
|
|
|
<h2 id="model-title">One expression system, from abstract range to concrete data.</h2>
|
|
|
|
|
</header>
|
|
|
|
|
<div class="definition-list">
|
|
|
|
|
<article>
|
|
|
|
|
<code>&</code>
|
|
|
|
|
<div>
|
|
|
|
|
<h3>Compose without discarding constraints</h3>
|
|
|
|
|
<p>Symmetric composition keeps information from both sides and fails when their ranges cannot overlap.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
<article>
|
|
|
|
|
<code>as</code>
|
|
|
|
|
<div>
|
|
|
|
|
<h3>Verify that a value is more specific</h3>
|
|
|
|
|
<p>The left side must fit inside the wider range on the right. Wider abstract fields remain available for later materialization.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
<article>
|
|
|
|
|
<code>//</code>
|
|
|
|
|
<div>
|
|
|
|
|
<h3>Apply an explicit structural patch</h3>
|
|
|
|
|
<p>Right-biased composition replaces the selected structure while preserving unrelated fields.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
<article>
|
|
|
|
|
<code>default</code>
|
|
|
|
|
<div>
|
|
|
|
|
<h3>Choose a fallback only when materializing</h3>
|
|
|
|
|
<p>A default does not erase the range. It is selected only when no more concrete value has been supplied.</p>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="home-section host-section" aria-labelledby="host-title">
|
|
|
|
|
<header class="section-heading">
|
|
|
|
|
<h2 id="host-title">The host owns I/O. Decodal owns evaluation.</h2>
|
|
|
|
|
<p>
|
|
|
|
|
Filesystems, Markdown, JSON, network resources, and application globals stay under host control. Decodal
|
|
|
|
|
receives source or structured values and evaluates them with the same rules in production and editor tooling.
|
|
|
|
|
</p>
|
|
|
|
|
</header>
|
|
|
|
|
<ol class="evaluation-flow" aria-label="Evaluation flow">
|
|
|
|
|
<li>
|
|
|
|
|
<span>1</span>
|
|
|
|
|
<strong>Host environment</strong>
|
|
|
|
|
<small>globals · source · structured imports</small>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<span>2</span>
|
|
|
|
|
<strong>Evaluate</strong>
|
|
|
|
|
<small>lazy references · constraints · composition</small>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<span>3</span>
|
|
|
|
|
<strong>Materialize</strong>
|
|
|
|
|
<small>defaults · validation · diagnostics</small>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<span>4</span>
|
|
|
|
|
<strong>Application data</strong>
|
|
|
|
|
<small>Data · Rust type · JavaScript value</small>
|
|
|
|
|
</li>
|
|
|
|
|
</ol>
|
|
|
|
|
<p class="section-link"><a href="/docs/embedding/">Read the embedding guide <span aria-hidden="true">→</span></a></p>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class="home-section package-section" aria-labelledby="packages-title">
|
|
|
|
|
<header class="section-heading">
|
|
|
|
|
<h2 id="packages-title">Use only the layer your application needs.</h2>
|
|
|
|
|
</header>
|
|
|
|
|
<div class="package-rows">
|
|
|
|
|
<article>
|
|
|
|
|
<div><code>decodal</code><span>Rust</span></div>
|
|
|
|
|
<p>Runtime, host embedding, schema derivation, and typed decoding.</p>
|
|
|
|
|
<a href="https://crates.io/crates/decodal">crates.io</a>
|
|
|
|
|
</article>
|
|
|
|
|
<article>
|
|
|
|
|
<div><code>decodal-wasm</code><span>JavaScript</span></div>
|
|
|
|
|
<p>Browser runtime and host-configurable semantic language service.</p>
|
|
|
|
|
<span class="package-links"><a href="https://jsr.io/@hare/decodal-wasm@0.3.0">JSR</a><a href="https://www.npmjs.com/package/decodal-wasm">npm</a></span>
|
|
|
|
|
</article>
|
|
|
|
|
<article>
|
|
|
|
|
<div><code>decodal-lsp</code><span>Rust</span></div>
|
|
|
|
|
<p>Language Server Protocol with application-defined environments.</p>
|
|
|
|
|
<a href="https://crates.io/crates/decodal-lsp">crates.io</a>
|
|
|
|
|
</article>
|
|
|
|
|
<article>
|
|
|
|
|
<div><code>decodal-codemirror</code><span>JavaScript</span></div>
|
|
|
|
|
<p>CodeMirror 6 syntax, indentation, folding, highlighting, and formatter integration.</p>
|
|
|
|
|
<span class="package-links"><a href="https://jsr.io/@hare/decodal-codemirror@0.3.0">JSR</a><a href="https://www.npmjs.com/package/decodal-codemirror">npm</a></span>
|
|
|
|
|
</article>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="section-link"><a href="/docs/components/">Compare packages and integrations <span aria-hidden="true">→</span></a></p>
|
|
|
|
|
</section>
|
|
|
|
|
</ManualLayout>
|
|
|
|
|
<HomePage locale="en" />
|
|
|
|
|