Commit 2834ae6
feat(selfhost): AST-dump parity keystone — format contract + total Rust oracle
Step 1 of moving the self-hosted frontend from tool parity to frontend OBJECT
parity (per the agreed AST → diagnostics → spans ladder). Ships the contract and
oracle BEFORE parser.rss builds an AST, exactly as the token FORMAT.md + oracle
preceded the rss lexer:
- selfhost/AST_FORMAT.md: canonical AST-dump format — an indentation tree, one
node per line, fixed tag set, structure+payload at tier 0 with spans deferred
to a later trailing-field tier (mirrors the lexer's tier ladder).
- crate::selfhost_parity: a TOTAL Rust oracle serializer over
crate::syntax::parse_source_raw (the surface-preserving tree, never the
desugared parse_source). Every Item/Stmt/Expr/Pattern/TypeRef variant is
rendered, so a future rss producer cannot pass by silently dropping a node.
- Tests: ast_oracle_dump_tiny_sample_golden + ast_oracle_dump_is_deterministic_smoke
(non-ignored) pin the format; ast_oracle_total_over_corpus (ignored) proves the
serializer renders all 556 corpus files deterministically without panicking —
totality over the real grammar, the precondition for a trustworthy oracle.
No parser.rss changes yet: this locks the target first. Existing lexer/parser/
checker parity untouched (all 7 non-ignored selfhost tests green; clippy clean on
the touched file). Roadmap recorded in docs/self-hosting-stress-test-plan.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 7ae0b13 commit 2834ae6
3 files changed
Lines changed: 973 additions & 0 deletions
File tree
- crates/rsscript/src
- docs
- selfhost
0 commit comments