Worked example · Building

Building a parser that passes a conformance suite with WDD

When a format or protocol comes with an official conformance suite, the suite is a ready-made verifier and WDD turns "implement the spec" into a countable grind: cases passed out of cases total.

The goal

Write a TOML parser that passes every case of the official test suite, with no dependency added.

The verifier

The conformance suite runner, which prints "N of M passed" and lists the failures.

Why this check: Written by someone else, so the agent cannot shape it to fit its own code.

The set-up

  • The suite vendored into the repository, read-only.
  • A runner that prints a one-line score and the first 20 failures.
  • The spec itself in the repository, so the agent can read it.

The kickoff prompt

Kickoff

Implement the parser in src/toml so that the conformance suite in test/conformance passes completely. Do not edit the suite. Read the spec in docs/spec.md when a case is unclear. Each round: run the suite, fix the first failing group, run it again. Keep going until every case passes.

How the rounds went

Rounds 1 to 6
A first parser handles the common cases: 410 of 620.
Rounds 7 to 20
Dates, escapes and table rules, one group at a time. 600 of 620.
Rounds 21 to 26
The last cases are invalid inputs that must be rejected. The agent had been too lenient; it adds the missing checks. 620 of 620.

What worked

  • A suite written by others: there is nothing to negotiate.
  • The spec in the repository, so the agent reads the rule instead of guessing it.
  • Fixing failures in groups (all date cases, all escape cases).

What to watch for

  • Watch for parsers that special-case the test inputs. Keep a few extra cases outside the agent's view and run them at the end.

Build a kit for a task like this

A worked example written to show the method, not a report of a specific project.

Questions people ask

What other tasks have a ready-made verifier like this?

Language test suites, protocol test kits, emulator test ROMs, benchmark suites with reference outputs, standards bodies' conformance tests. They are the best WDD tasks there are.

More examples