Skip to content

[Language] Add a machine-checked .gwdk conformance corpus #295

@cssbruno

Description

@cssbruno

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation workparser.gwdk parser and syntax handling

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions