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:
- Syntax / grammar — anything the parser can't accept, and bad tag/param shapes (a positional param where a key is required, a malformed signature).
- Unfounded references — a name used but never declared, and edges to targets that don't exist. A fragment that omits its corpus raises these as warnings, not errors.
- Kind & type consistency — re-declaring an entity as a different kind, a facet used inconsistently across a name, a typed signature param handed the wrong kind.
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 gatebundles validate + round-trip + preamble.- WASM
validate(src)—{ diagnostics: [{ severity, line, message, fix? }] }, corpus-aware onceload_corpushas run.