Problem
The .gwdk language contract is documented as prose in docs/language/grammar.md
and docs/language/spec.md, but nothing executable pins it. There is no
conformance corpus of accept/reject samples with golden diagnostics, and no
machine-checked grammar verified against the parser. The contract can therefore
drift silently: a parser change can accept or reject syntax that the spec still
describes the old way, and no test catches it.
For a milestone literally named "Compiler + Language Contract," a frozen,
CI-run conformance corpus is the artifact that makes the contract real.
Relevant code:
docs/language/grammar.md, docs/language/spec.md: prose contract
internal/parser, internal/lang: parse + check entry points
testfixture/, internal/*/testdata: scattered existing fixtures
Scope
Introduce a versioned language conformance corpus:
accept/ samples that must parse and validate clean.
reject/ samples that must produce a specific stable diagnostic code (and,
where available, span).
- Golden diagnostics regenerated deterministically by a test runner.
- A doc mapping each grammar production / spec section to at least one fixture.
Optionally add a machine-checked grammar (EBNF) and assert the corpus exercises
every production. Keep the corpus the cited source of truth in the spec.
Acceptance Criteria
- A conformance corpus directory exists with accept and reject cases.
- Each reject case asserts a stable diagnostic code; golden output is
deterministic and regenerable.
- A CI test runs the corpus and fails on drift.
docs/language/spec.md and grammar.md reference the corpus as the contract
source of truth.
- Adding new syntax requires a corpus entry (documented in
docs/compiler/syntax-contributors.md).
Verification
go test ./internal/lang ./internal/parser
# plus the new corpus runner package
Problem
The
.gwdklanguage contract is documented as prose indocs/language/grammar.mdand
docs/language/spec.md, but nothing executable pins it. There is noconformance corpus of accept/reject samples with golden diagnostics, and no
machine-checked grammar verified against the parser. The contract can therefore
drift silently: a parser change can accept or reject syntax that the spec still
describes the old way, and no test catches it.
For a milestone literally named "Compiler + Language Contract," a frozen,
CI-run conformance corpus is the artifact that makes the contract real.
Relevant code:
docs/language/grammar.md,docs/language/spec.md: prose contractinternal/parser,internal/lang: parse +checkentry pointstestfixture/,internal/*/testdata: scattered existing fixturesScope
Introduce a versioned language conformance corpus:
accept/samples that must parse and validate clean.reject/samples that must produce a specific stable diagnostic code (and,where available, span).
Optionally add a machine-checked grammar (EBNF) and assert the corpus exercises
every production. Keep the corpus the cited source of truth in the spec.
Acceptance Criteria
deterministic and regenerable.
docs/language/spec.mdandgrammar.mdreference the corpus as the contractsource of truth.
docs/compiler/syntax-contributors.md).Verification