This repository is the public distribution of the independent, kernel-free A12 Document Model interpreter. Development happens in the main a12-dmkits project; this mirror contains immutable release assets, the cumulative Maven repository, versioned API references, and the browser showcase.
Independent project. This is not an official A12 or mgm artifact.
Open the A12 Interpreter browser showcase β
Use the built-in models and Documents or load your own local workspace. Your selected files stay in the browser.
- π Try the live browser showcase β
- π Read the developer API guide β
- π§ Browse the TypeScript API β
- π§ Browse the Kotlin API β
- π Open the public release site β β current version, installation coordinates, showcase, API references, and privacy information
- π οΈ Explore the main
a12-dmkitsproject β β source, design, benchmark method, and complete test evidence
- Finite in-memory workspaces and on-demand model providers
- Self-contained model expansion, separate from evaluator preparation
- Lossless, versioned Document JSON with structured input diagnostics
- Deterministic model-shaped Document seeds containing every declared group and field
- Full and partial validation, retained computation application, support reports, and model-owned pointers
- Canonical A12
DocumentPointerformatting and parsing, so a repeated computed row is separately addressable - Synchronous custom field validators and custom conditions
- Thread-safe model reuse: one prepared model serves concurrent requests, each with its own interpreter
- Explicit resource limits, integrity checks, cancellation, and prepared models that are immutable to callers
- The same Kotlin implementation on JVM, Node.js, and browser targets
The package does not author models, render forms, persist Documents, provide a virtual filesystem, or bundle Kernel code. Kernel-shaped TypeScript and JVM drop-in adapters are separate, later compatibility products.
Semantics target. This release reproduces the evaluation behavior of A12 Kernel 31.3.1, as shipped in the A12 Tools 2026.06-ext2 distribution. The implementation is clean-room and is verified by differential testing against that kernel; the target version is stated so you can tell which kernel's semantics a given release was matched to.
Click the infographic to open the full-resolution image.
Kotlin Multiplatform lets this one evaluation engine serve JVM, Node.js, browser, and native dmtool consumers. GraalVM is the delivery mechanism for the separate dmtool executable, not the source of Interpreter semantics. The real A12 Kernel does not ship in this package; it remains the model-acceptance authority in dmtool and the external oracle for the differential tests that verify this clean-room implementation.
Click the infographic to open the full-resolution image.
β Performance and footprint β what the package costs to ship, how fast it validates in the browser and on the JVM, what a resident model costs, and how each figure was measured.
Click the infographic to open the full-resolution image.
Install the npm-compatible tarball directly from the GitHub Release:
pnpm add https://github.com/mbackschat/a12-interpreter-releases/releases/download/v0.16.0/a12-interpreter-0.16.0.tgzDocuments are A12's own Document JSON β the shape the A12 Kernel serializes: a nested object tree, a repeating group as an array whose index is the repetition, native JSON for numbers and booleans.
Keep the prepared model and interpreter when a form validates repeated edits; read a new immutable Document snapshot for each change.
The Document shown below is decoded against the prepared model before evaluation. When its structure is not yet known, prepared.documents.seedDocument() creates a best-effort candidate with every declared group and field and one row per repeatable group; computation-owned targets remain present-empty for the engine to fill.
import {
type DocumentSnapshot,
type Interpreter,
ModelWorkspace,
type A12Document,
} from "@mbackschat/a12-interpreter";
export function runInterpreter(rawModelJson: string) {
const workspace = ModelWorkspace.fromSources([{json: rawModelJson}]);
const prepared = workspace.prepare("permit-basic");
const starter = prepared.documents.encodeDocument(
prepared.documents.seedDocument(),
);
const input: A12Document = {
Permit: {ApplicationNo: "P-42", RequestedArea: 120},
};
const document = prepared.documents.readDocument(input);
const interpreter = prepared.createInterpreter();
const relevant = prepared.model.relevantPointer(
"/Permit/RequestedArea",
[1, 1],
);
return {
full: interpreter.validateFull(document),
partial: interpreter.validatePart(document, [relevant]),
computation: interpreter.compute(document),
starter,
document,
prepared,
};
}interpreter.compute(source) returns report-all results, target diagnostics for ERRORED results, eager formalErrorsInOperands, Kernel-equivalent noErrorOccurred, and source-relative actions. Retain that report and call applyTo(destination) to apply it without recomputing; source and destination must belong to the same PreparedModel. unsupported remains an independent support axis. interpreter.applyComputations(source) is the same-document convenience. Every snapshot remains immutable.
The ordinary form-engine sequence is explicit and Kernel-shaped: const computation = interpreter.compute(document); const applied = computation.applyTo(document); const validation = interpreter.validateFull(applied);. The form retains applied.
Resolve the first-party publication from this repository's GitHub Pages Maven repository. Third-party Kotlin dependencies continue to resolve from Maven Central.
repositories {
maven("https://mbackschat.github.io/a12-interpreter-releases/maven")
mavenCentral()
}
dependencies {
implementation("io.github.mbackschat.a12.dm:dm-interpreter:0.16.0")
}Java callers use the same JVM artifact; ModelWorkspaceJava.collect projects asynchronous model providers through CompletionStage.
The Kotlin and Java surface has the same shape as the TypeScript one: prepare a workspace, read a Document against the prepared model, then create an interpreter and ask it for validation or computation. The differences are idiomatic rather than structural β model sources are assembled through a typed builder, and readDocument takes A12 Document JSON as text.
import io.github.mbackschat.a12.dm.interpreter.ComputationReport
import io.github.mbackschat.a12.dm.interpreter.ModelWorkspace
import io.github.mbackschat.a12.dm.interpreter.ValidationReport
import io.github.mbackschat.a12.dm.interpreter.WorkspaceModelSource
data class InterpreterResult(
val starterJson: String,
val validation: ValidationReport,
val computation: ComputationReport,
)
fun runInterpreter(modelJson: String): InterpreterResult {
val source = WorkspaceModelSource.builder().json(modelJson).build()
val prepared = ModelWorkspace.fromSources(listOf(source)).prepare("permit-basic")
val starterJson = prepared.documents.encodeDocument(prepared.documents.seedDocument())
val document = prepared.documents.readDocument(
"""{"Permit":{"ApplicationNo":"P-42","RequestedArea":120}}""",
)
val interpreter = prepared.createInterpreter()
return InterpreterResult(
starterJson = starterJson,
validation = interpreter.validateFull(document),
computation = interpreter.compute(document),
)
}ValidationReport and ComputationReport carry the same information as their TypeScript counterparts, including the model-owned pointers that tell apart the rows of a computation inside a repeatable group. Java consumers use these same types directly; a worked Java example lives in the developer API guide linked above.
One thing to carry over from Server-side model cache below: the PreparedModel returned by prepare is the expensive, reusable part and is safe to share across concurrent requests, while the Interpreter from createInterpreter() is per request. Retaining the prepared model and creating an interpreter per call is the intended pattern, not an optimization.
ModelWorkspace.fromSources freezes a caller-supplied finite source set. ModelWorkspace.collect asks a caller-owned provider only for dependencies discovered from the entry model and loads each exact id at most once. Neither method performs implicit I/O.
expand(entryModelId) returns self-contained DM-JSON after resolving includes, imported type definitions, exclusions, ids, and cross-model references. prepare(entryModelId) continues through evaluator support checks and returns a reusable PreparedModel. Use PreparedModel.loadExpandedJson when that self-contained artifact is already available.
Preparation rejects ambiguous or incomplete workspaces instead of choosing a source-order winner. Errors carry stable structured diagnostics; provider exception messages, file paths, URLs, and credentials are not copied into them.
What matters for this repository is that the browser showcase uses that same public provider/workspace boundary. You can use its built-in examples or select your own local folder, model files, and Document; selected files remain in the browser.
A prepared model is shareable across concurrent requests; an interpreter is not.
A PreparedModel owns everything derived from the model alone β condition and operation ASTs, iteration scopes,
uniqueness plans, the path index, the computation dependency order β memoized in thread-safe lazy state. One cache
entry therefore serves every tenant and every concurrent request for that model, whatever their configuration, and a
second interpreter over it performs no model-static work at all. In the shipped consumer example, 12 concurrent
requests across 4 threads over 3 models cost 3 preparations.
An Interpreter is per request. That is a safety requirement, not a cost preference: it carries snapshot-scoped
state that custom conditions read, so sharing one across threads is unsupported.
Four things to know before sizing a cache:
- A resident prepared model is larger than the DM-JSON it came from, and the ratio moves with model SHAPE rather than size, so size the cache in bytes, not entries. The measured per-model cost and the structural budgeting rule are in Performance and footprint.
- An undersized cache is not slightly worse, it is no cache plus eviction overhead. The same 12 requests through a cache one entry too small cost 12 preparations and 10 evictions.
- The cache is necessarily in-process: a prepared model is a live instance with a per-instance owner identity and no serialization, so only the expanded DM-JSON can live in a shared tier.
The complete pattern β cache keying, single-flight loading, eviction safety, and the trade-offs β is in the developer API guide.
The clean-room implementation is tested against the normative dynamic-Groovy Kernel strategy and against static Java wherever both Kernel strategies agree. JVM, Node.js, and packed-package Chrome consumers run the same portable behavior corpus.
The core is MIT-licensed and contains no Kernel bytecode or runtime dependency. Supported model time zones are UTC, GMT, and Europe/Berlin; all four A12 Date precisions are supported. supportReport() and the unsupported members on validation and computation results keep unsupported programs explicit; each entry's subject says whether it addresses a model element or a single Document cell.
Measured with locmetry from the standalone interpreter, shared regex sources, TypeScript facade, and browser showcase, using .locmetryrc. Only tracked source files are counted; generated code, data fixtures, documentation, third-party wrappers, and build output are excluded. Code excludes comments and blank lines.
Product implementation and examples.
| Language | Files | Lines | Code | Comments | Blanks |
|---|---|---|---|---|---|
| CSS | 1 | 886 | 749 | 3 | 134 |
| HTML | 1 | 333 | 321 | 0 | 12 |
| Kotlin | 157 | 36559 | 23045 | 10391 | 3123 |
| TypeScript | 18 | 3840 | 3252 | 306 | 282 |
| Total | 177 | 41618 | 27367 | 10700 | 3551 |
Automated tests, laws, differentials, consumer checks, and their support code.
| Language | Files | Lines | Code | Comments | Blanks |
|---|---|---|---|---|---|
| Java | 2 | 166 | 145 | 2 | 19 |
| JavaScript | 2 | 154 | 137 | 0 | 17 |
| Kotlin | 355 | 38803 | 30423 | 4186 | 4194 |
| TypeScript | 19 | 3506 | 3267 | 87 | 152 |
| Total | 378 | 42629 | 33972 | 4275 | 4382 |
Maintainers regenerate these tables with the latest locmetry; release publishers compare them with fresh counts before any public mutation.
This release contains:
a12-interpreter-0.16.0.tgzβ npm-compatible TypeScript/JavaScript package with the compiled browser/Node runtime, declarations, source maps, README, and license.dm-interpreter-0.16.0-maven-repository.zipβ complete offline Maven repository containing the Kotlin Multiplatform, JVM, and JS artifacts, Gradle metadata, POMs, documentation JARs, source JARs, and checksums.dm-interpreter-0.16.0-api-docs.zipβ versioned developer guide plus generated TypeScript and Kotlin API references for offline use or static hosting.dm-interpreter-0.16.0-showcase.zipβ deployable static browser showcase, including its built-in example workspaces, Documents, conformance data, and measured bundle metadata.release-manifest.jsonβ machine-readable release identity, source tag and commit, package coordinates, supported targets, artifact sizes, and SHA-256 digests.SHA256SUMSβ checksum list for verifying every release payload and the manifest.
Published GitHub Release assets and versioned Maven/API directories are immutable. A defect is fixed in a later patch release rather than by replacing a published artifact.
The interpreter core and showcase are licensed under the MIT License. See the independence disclaimer and the showcase's site-specific privacy notice.