Engine · 2

Validation

The diagnostics pass runs over a parsed file. It reports malformed syntax, references that resolve to nothing, and tag or parameter shapes that don't hold up. It backs the editor's as-you-type diagnostics and the conversion gate.

Structural checks

Over a single buffer, validation flags:

char vale [+Grifter]
obj ledger
vale > ledger
scene the_switch {
  beat 1 { evt e [&Deceives(agent=vale, target=renn)] }
}

Corpus-aware validation

Point validation at a loaded corpus and it checks vocabulary, not just structure (engine 0.14+). An invented or mis-sigiled facet — a [+Monoarticular] where the corpus declares [=Monoarticular] — is flagged with kind-ranked "did you mean" suggestions and a quick-fix. And a concept-typed param given a value that isn't a declared concept is warned. Corpus- resolvable names are never false-flagged, so a clean chart stays quiet:

$ tropelang validate chart.trl --corpus file://trl --strict
chart.trl:12  warning  [+Monoarticular] is not corpus vocabulary — did you mean [=Monoarticular]?
                       (fix: rewrite with the = facet sigil)

--strict exits non-zero on any warning (for CI / pre-commit); --json emits { file, ok, errors, warnings }. The style guide covers authoring a corpus so these lints stay clean.

With an exclusive partition in scope, --corpus also runs partition hygiene (engine 0.33). It flags a chart that asserts two members of one partition on one entity — a contradiction the partition rules out, though nested taxonomy pairs where one contains the other are exempt — a total partition whose members are all negated (nothing left to resolve), and a load-time label-namespace collision where a partition label is also declared vocabulary. These land as corpus-level notes on stderr (tropelang: note — …), additive to the --json payload and the --strict exit code.

Interfaces

CLI
tropelang validate <file> [--corpus <url>…] [--strict] [--json]; tropelang gate bundles validate + round-trip + preamble.
WASM
validate(src){ diagnostics: [{ severity, line, message, fix? }] }, corpus-aware once load_corpus has run.