Engine

The engine

One zero-dependency Rust core reads, checks, and reasons over .trl. The editor, the embed, the CLI, and any headless host are front-ends over it, so their results agree by construction. This section documents its capabilities in dependency order, each building on the one before.

  1. 1 ParsingLex → AST → canonical serialize. The lossless, idempotent round-trip every other capability is built on.
  2. 2 ValidationStructural and corpus-aware diagnostics — what validate catches, and the --corpus vocabulary lint.
  3. 3 RecognitionScore a trope's when: coverage into a Confirmed / Possible / In-Flight ladder. The !/? marks and the base-rate prior.
  4. 4 EvaluationForward-chain a story's rules to a fixpoint — which tropes fire, derivation, and the state at any point.
  5. 5 FrontierBackward-chain a goal to the AND/OR set of observations that would prove it — the acquisition worklist.
  6. 6 PredictionForward-project which observation moves the board most — information gain, and the Bayesian posterior over the differential.
  7. 7 CLIThe tropelang command-line reference — every verb, grouped, with the exit-code and --json conventions.

The ladder

Parsing produces an AST that serializes back losslessly. Validation reports what is malformed or unfounded. Recognition scores which tropes a story exhibits; evaluation forward-chains its rules to a fixpoint. The two planning capabilities build on that base: frontier chains backward from a goal to the observations that would prove it, and prediction ranks forward which observation most changes the result. The grammar defines the syntax; this section covers what the engine computes from it.

Surfaces

The same core is addressable four ways; each exposes the identical capabilities:

CLI
The tropelang binary — validate, shape / suggest, eval, drams, frontier, predict, and the corpus tools (full reference). Prebuilt binaries ship on tropelang-standard releases.
WASM
The same core compiled with wasm-bindgen, no DOM dependency — published as @kelnishi/tropelang-wasm. Each capability page names its export.
Editor & embed
The editor is the browser IDE; @tropelang/embed is the <tropelang-snippet> web component that makes every example on this site live. Both are thin layers over the WASM core.
Authoring API
A document-scoped surface for bring-your-own-AI: an agent reads, analyzes, and patches a buffer through a validate-before-apply gate, never touching the filesystem or network. See BYO-LLM (MCP).

Round-trip fidelity (parse → serialize is lossless and idempotent) and cross-surface agreement are verified by the project's test harness across the corpus. The reasoning verbs read a chart (a .trl of facts so far) against a corpus (the rules) and never mutate either.

License & source

TropeLang the language is an open standard. The engine that implements it — the Rust core, its WebAssembly module (on npm) and the CLI (prebuilt binaries on tropelang-standard) — is proprietary and closed-source: built from a private source and distributed in binary form only (© 2026 Kelvin Nishikawa; all rights reserved). You may use and execute it for any purpose, including commercial, and redistribute or embed it unmodified — but the source is not provided, and reverse-engineering or modifying it is not permitted. Both the module and the CLI carry these same terms (the module under the TropeLang WebAssembly Module License). The standard corpus, by contrast, is open (CC0-1.0) — the vocabulary and tropes are yours to build on.