Skip to content

Commit ab10946

Browse files
Smaug123claude
andcommitted
Add the type-erased arg-parser runtime kernel with property tests
ArgParserRuntime is the future core of the generated argument parser: a pure, type-erased kernel (scan argv into an ordered event log; select discriminated-union cases; validate against the schema shape) which will be embedded verbatim into generated parser output and drive a thin typed layer of converters and record assembly. It supports Leaf/Product/Sum schemas: sums are the upcoming DU-alternative feature, selected shape-first ("exactly one interpretation consumes every argument") with globally-unique argument names. Nothing consumes it yet; the generator cutover comes separately. Tests include an executable reference semantics (expand every sum into its complete alternatives; accept exactly one) and FsCheck properties: - compositional selection == exhaustive alternative expansion, over random schema trees and observed-sets fuzzed across valid/noisy/empty regimes, with instrumented distribution assertions; - scanning is lossless (unscan . scan = id) for arbitrary token lists; - a trailing "--" appends exactly a Separator event; - round trip: rendered command lines scan to exactly the intended events, across =/space forms, case variation, negation, bare flags. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent aed0824 commit ab10946

4 files changed

Lines changed: 1644 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)