agent: builder model: opus max_turns: 120 budget_usd: 25 —

Brief: #557 step 3, the grammar language gets same_line (compiler lane, Part #557)

Score: the bootstrap’s critical path (docs/bootstrap.md, section 2, Critical path: the parser): parser/mod.rs (2,280 Rust lines) is ported as a Nikaia grammar only after #557 steps 1-3; steps 1-2 are on develop (2ca9841, 9545797). Due green by Friday 10-30 evening, else section 5 Risks. S=3, C~6-10 M. Runs in the fix checkout C3, one agent at a time.

If crates/nikaia-compiler/src exists, R0 (#921) has run: read every crates/nikaia-std/src/tools below as crates/nikaia-compiler/src, and nikaia_std::tools:: as nikaia_compiler::.

Owns: crates/nikaia-std/src/tools/emit_grammar.nika, check_grammar.nika, grammar_decode.nika (only if it decodes patterns), emit_pattern.nika and emit_state.nika (only the built-in pattern arms, as step 2 touched them at emit_pattern.nika :117-121, :177; lent from the lowering lane for this brief, C3 runs one agent at a time), crates/nikaia-std/src/grammar.rs (only the new line-break record), crates/nikaia-std/src/lib.rs and std.contracts only if that type needs an entry (as step 2’s text::Span did), new tests under tests/compiler/tests/, the generated tools/lowered/*. Not yours: crates/nikaia/src/parser/mod.rs (the Rust grammar keeps its own extern rule same_line until step 5), grammar_run.rs and build_time.rs (lane 1’s: a change there is a Needs:), everything a move lane owns (docs/bootstrap.md, File ownership).

Issue text (#557, copied; decided: ADR-339 D2, Part II 10.8)

Facts

To build

  1. same_line in the checker (check_grammar.nika, beside span/here at :123-126, :196): arity 0, binds nothing; a grammar’s own rule same_line wins. In the lowering as decided above. Tests, each a .nika with its .stdout: tests/compiler/tests/grammar_same_line.nika (a grammar with postfix = name (same_line "[" n "]" | same_line "(" n ")")* over text and over Bytes: a\n[0] and f\n(x) are a name followed by something else, not an index and not a call; a [0] and f (x) are; a backtracking case: an alternative that skips the line break and fails, then one that asks same_line at the same place, gives the same answer); tests/compiler/tests/grammar_same_line_own_ws.nika (a grammar with its own rule WS = (multispace1 | "//" until(line_ending) | "/*" until("*/") "*/")*: a // c\n[0] not an index, a /* c */ [0] an index, a /*\n*/ [0] not an index). Commit grammar: same_line (#557 step 3), Part: #557, together with the lowered files.

Done when

nikaia test tests/compiler --both-settings (every count as before plus the new tests; emit_* changed, so both settings); it tests filtered on grammar plus the guard set of .claude/agents/builder.md; clippy clean; lower-std fixpoint after the rebase. Changelog: one line for the supervisor under Changelog: (a language change raises the version; you do not).

Stop and report if

winnow-grammar cannot carry a state in a generated grammar over input bytes, or its entry functions cannot be handed one (then say what it offers: the decision is the architect’s); a .stdout/.stderr of an existing test changes (a grammar without same_line must lower byte for byte as before); a change in grammar_run.rs, build_time.rs or parser/mod.rs is needed.

Read docs/builder-facts.md.

Rules (CLAUDE.md; worktree lane, docs/bootstrap.md section 3)

Report (at most 15 lines, to exactly /home/user/Nikaia/docs/briefs/lane-bugs-557b-same-line.md.report.md)

Fields of docs/architect.md, Briefs and reports: Result: done|noop|partial|blocked (the bare word alone on that line: Result: done, never a summary after it, which cuts the batch, b869a 2026-10-27; Owner: is a question for the owner or none, never a role), Files, Commit, Body (optional, one paragraph for the commit message), Fixes, Pushed, Tests, Gate (green|red), Deviation, Found, Needs, Changelog, Owner, Disk freed, and for a move Rs2nika: (the kept N of M lines of rs2nika --score, then the three costliest hand edits; none for a task that moves no Rust). none where nothing, and then the bare word: Deviation: none (a note) cuts the batch (batch.nika compares exactly); a note goes into the commit message. Found: is only for a defect outside your change (it cuts the batch); a converter draft that came out wrong is no Found:, it is one of the costliest edits under Rs2nika:, which the converter lane reads (e12-4b 2026-10-27); how you solved your own step goes into the commit message. Deviation: is only a step of the brief built otherwise than written or not built (a choice the brief left to you, such as keep what X needs and say so, is no deviation: it goes into the commit message; nor is building two steps in one commit when every step is built, e12-3a 2026-10-27, nor a step another commit on develop already built, shown by your test failing with that commit’s change reverted, b889 2026-10-27: name the commit in Body:); how you verified (e.g. a test not run against the unfixed compiler) goes under Tests:. A noop says why under Tests: (what was probed), not under Deviation:. Final answer, one line: done <sha>, report <path> (or BLOCKED: ... / PUSH REJECTED ...).

Attribution: Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Claude-Session: https://claude.ai/code/session_01GFeMqxRbtUMiGVyDMxsvEq

This site is open source. Improve this page.