HoldFastPlayground

HoldFast development parser qualification

The Rocq-extracted parser serves the pure compiler. The Menhir code backend also accepts the wider surface for mathematical elaboration. Both emit located JSON syntax for separate resolution, typing and elaboration. Pure compiler · Surface grammar · Mathematical elaborator

Bounded increment

Both parser entry points consume a complete file. Parsing can succeed for duplicate declarations or true + 1. The compiler checks names and types after parsing. Unsupported keywords, invalid UTF-8, incomplete input and resource exhaustion yield located refusals. Surface expression generics use a bounded token-only probe. Angle-argument rule

The Menhir grammar and OCaml AST define nodes with half-open source byte spans. Diagnostics use one-based lines and code-point columns, recognizing LF, CRLF and bare CR. The envelope binds the original bytes by digest and preserves decimal spelling, including leading zeros within the digit limit. Comments accept UTF-8 and identifiers use ASCII.

The development parser builds the pinned Menhir fork with Dune and OCaml from the locked tool switch. Build receipts bind authored inputs, tools, arguments and generated files. Generated parser source and binaries stay in native build directories. Generator terms

The driver bounds source bytes and literal digits and caps delimiter and raw tree depth at 256, including groups, files, functions, blocks and returns. Stack exhaustion is a limit refusal. The pure decoder caps expression and block/binding depth at 64. The wrapper bounds file reads and runtime. Successful parses emit complete, deterministic located JSON.

Acceptance and commands

python tools/run.py holdfast-parser build generates and compiles the parser in the native guest lane. holdfast-parser parse SOURCE uses the Menhir code backend and emits schema-1 JSON for the pure grammar. Add --surface to parse the wider development grammar and emit schema-2 JSON. holdfast-parser qualify builds it and runs independent expected-tree fixtures, whole-file positive/refusal cases, source spans, LF/CRLF/bare-CR positions, UTF-8 comments and invalid encoding, decimal spelling, precedence and associativity, incomplete editor input, excessive nesting and oversized input. Qualification checks that name and type errors parse as syntax and compares two fresh generations. The development-syntax receipt binds the surface oracle and the example bytes it exercised. Checked parsing, lexical correctness, source correspondence and frontend acceptance have their own obligations.

Ordinary build cache

holdfast-parser parse, holdfast-parser elaborate, holdfast-parser model-check, and holdfast-playground reuse a development parser in the native worktree lane's holdfast-parser/ordinary-cache directory. Each lookup checks the exact build-input hashes, selected toolchain versions and executable hashes, generation/compilation arguments, receipt scope and directory, and all generated-output hashes. A missing, outdated, or damaged entry is rebuilt. The receipt records only built syntax tooling; a cache hit supplies no qualification or kernel verdict. Editing parser qualification fixtures alone reuses the executable generation.

Builders wait up to 120 seconds for the cache lock. A successful build atomically updates the pointer to the current generation. A failed build leaves the previous pointer in place. Independent OS-lock leases let CLI readers share immutable generations and keep a running playground's parser available after a grammar edit.

The cache keeps the current generation and any older generation still in use. It reclaims unused older generations and interrupted entries on lookup or lease release. A reader crash releases its OS lock. Explicit holdfast-parser build and qualification build fresh outside the cache and retain their evidence.

Generated syntax campaigns

python tools/run.py holdfast-parser syntax-campaigns includes parser qualification and the pure parser comparison. It uses the locked Menhir generator and deterministic seeds to exercise interactions among multiple declarations, precedence, trailing commas and trivia. A bounded renderer turns terminal sentences into source with canonical, UTF-8 comment and newline variants. The requested sentence length guides generation. Independent caps bound tokens, bytes, elapsed time, memory and interpreter output.

Menhir's interpreter and CST exercise the grammar. An independent oracle checks native syntax trees and source spans, including cases the automaton accepts and an action refuses. Seeded action and span faults exercise the oracle. Reports bind the exact tools, grammar, seeds and rendered inputs. Reduced failures replay without random generation. Campaign implementation · Fixture checks

Checked parser boundary

Both backends generate their pure productions from the same Menhir source. The checked generator binds a separate set of Rocq actions to those productions and refuses production changes against a reviewed fingerprint. The checked route uses conflict-free grammar generation, replays the concrete correctness and completeness theorems, and checks the extracted runtime's identity before use. The theorems concern parsing a token stream. Source spans, diagnostics, lexical correctness and checked source correspondence have separate obligations. Verification strategy

The self-hosting contract governs retirement of Menhir from the required build and migration of syntax consumers.

Pure parser comparison

The checked runtime serves pure compilation, evaluation, inspection, formatting and linting through its framed batch protocol on Linux and through WSL on Windows. The shared AST decoder validates each envelope's schema, exact source digest, token spelling, child spans and resource bounds before semantic checking.

python tools/run.py holdfast-parser migration compares the checked route with the Menhir code-backend route. They must agree on independently categorized fixtures, source edits, diagnostic categories and positions, resource boundaries and full emitted Gallina bytes. Differences are recorded in migration.json and fail the command. The receipt binds source, tools and generated parser bytes.

Rocq support prerequisite

python tools/run.py holdfast-parser support authenticates the pinned Menhir fork. It builds the generator with the locked Menhir switch, builds Rocq support from the same fork revision under the locked proof switch, and generates the concrete pure grammar with menhir --rocq --strict. Supply --archive FILE to use a filtered archive. The fork includes the Interpreter.v proof-command fix, keeps the item map abstract in Validator_complete.v and optimizes the safety and completeness validators. The version control accepts require_unreleased and refuses require_20260209. Support build · Support library terms

The build checks deterministic grammar generation and extraction and replays holdfast_file_safe, holdfast_file_complete_validator, holdfast_file_correct, holdfast_file_complete, holdfast_file_unambiguity and the concrete precedence, bare-local, empty-module and zero-fuel controls. The assumption audit requires a closed global context and recursive rocqchk validates the support closure.

Extraction links the checked OCaml parser with the authored AST, lexer and driver. Runtime builds are keyed by the digest of their checked inputs, including the generated Rocq-action grammar and lexer token stub, so worktrees with identical inputs can share a receipt-verified executable. The lexer, framing and JSON decoder remain outside the token-parser theorem.