writeonce/docs/stories/language-runtime-database/03-compiler-front.md
shoney.arickathil c0b0dbb846 docs: audit all markdown against the code, fix findings, flatten status folders
- README: shipped concurrency/HTTP/WebSockets sat in the roadmap as "not yet
  available"; "no package manager" contradicted [deps]; the deps example
  would not have compiled (the key IS the module name)
- runtime/README: leads with wovm, wo-rt.c demoted to a historical section;
  dropped 2 nonexistent recipes, crates/rt, @gc refcounting, 13 suites -> 18
- employee + log-watcher READMEs claimed "does not compile"; both are gates
- error catalog: +10 emitted codes incl WO-E250, the only diagnostic the
  shipped query surface raises; recorded why the sweep rotted
- language-surface: group-by parses, then the typechecker refuses it
- 00-code-review + 00-link-audit re-run; history kept, not rewritten
- 48 dead Rust-era exploration links de-linked rather than re-pointed (their
  prose names the retired plan by number); successor map -> discarded.md
- 08-project-structure: compiler/plan/ never existed; corpus has 9 dirs, 5 empty
- releasing.md: dropped a --draft step the workflow never had
- new docs/00-doc-audit.md: findings + disposition, incl one row where the
  audit was wrong and the doc it accused was right
- status folders removed: 34 stories flat, status only in frontmatter; 252
  links recomputed from resolved paths; board/board-views/structure retaught
- story 24 -> in-progress, since frontmatter is now the only truth
- new iteration 38: fs mutation verbs + net.connect, the two capability
  families no iteration owned
- new iteration 39: gofiber/fiber v3.5.0 parity study. The ledger called
  CSRF/sessions unblocked by iteration 34's HMAC, but the runtime has no
  source of randomness at all
- linkcheck skips .dev/.superpowers: 0 broken paths, 0 bad anchors

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 19:20:22 +02:00

59 lines
2.2 KiB
Markdown

---
iteration: "3"
status: done
---
# Iteration 3 — compiler front (`woc`)
> Format: `product/story-iteration-template`. Part of
> [Story — one language, one runtime, one database, one binary](00-story.md).
## Goals
- An OCaml, stdlib-only compiler front end: `.wo` source becomes a typed
AST with ownership annotations, or plain, precise diagnostics — the
half of the language the developer converses with.
- Ownership errors read like sentences naming both sites ("moved at
pricing.wo:14, used at pricing.wo:17") — the ergonomics bet that makes
MVS beat Rust for this audience.
## Acceptance Criteria
- What to achieve?
- **Given** the pricing-demo classes,
- **when** `woc` runs its front pipeline (lex → parse → typecheck →
ownership),
- **then** `--dump-ast` output matches the golden file and zero
diagnostics are emitted.
- What to achieve?
- **Given** a file violating ownership rules (move-after-use, borrow
escape, double exclusive borrow),
- **when** it compiles,
- **then** each violation reports a stable `WO-E###` code with both
source sites, and one bad declaration does not stop diagnosis of the
rest of the file.
- What to achieve?
- **Given** a class that satisfies an interface structurally,
- **when** typechecking runs,
- **then** satisfaction is recognized with no `implements` declaration,
and per-method `self` mutability is inferred (reads shared, writes
exclusive).
## Out Of Scope
- Bytecode emission and running anything (iteration 4).
- The Haxe-parity adoptions (iteration 5) — milestone grammar only.
## Info
- Newline-significant lexing and the identifier gotchas mirror
`crates/rt`'s lexer — grammar parity is a stated contract.
- Architecture map: `docs/plan/compiler/architecture.md` (pipeline, module
contracts, study references).
## Proposed Solution
- Execute the existing plan: `docs/plan/compiler/2026-08-01-woc-compiler-front.md`
(diagnostics module, lexer, declaration/statement/expression parsers with
skip-on-block, typechecker with field-kind derivation, MVS ownership pass
producing the four emitter tables, driver + error catalog).