Repository navigation
epic: t27b in t27 -- port the backend and its tooling from Rust/Python into .t27 #6198
Copy link
Copy link
Open
10 / 1010 of 10 issues completedOpen
10 / 1010 of 10 issues completed
Copy link
Labels
Description
Problem
Owner, 2026-10-05: t27b must be written in .t27. Today none of it is:
cli/t27b/src/*.rs: 8247 lines of hand-written Rust, and it mountsbootstrap/src/compiler.rsthrough#[path]. Its tests incli/t27b/tests/*.rsadd 2865 more.scripts/tri_loop/t27b.py: 894 lines of Python (tri t27b status|doctor|delta|ratchet).contrib/railway/t27b-lab/lab.py: 608 lines of Python (the Railway lab).
(Line counts are fromwc -lon master c532fca.)
Proposal
- Spec first: each t27b stage (front, lower, ir, codegen/a64, macho) gets a
.t27spec withtestblocks, generated witht27c gen-rust. The first slice to port is the smallest pure one. The steward tool's pure functions (honest,delta,ratchet) are the candidates, because they have fixtures already. - This rides on the self-host epic epic: self-host t27c -- rewrite the compiler from Rust into t27 #5980: whatever gen-rust cannot yet express gets filed there, not worked around by hand.
Done when
- Every t27b source file is generated from a
.t27spec. The hand-written remainder is listed inAGENTS.md, and that list only shrinks.
Boundary
bootstrap/src/compiler.rscontrib/railway/t27b-lab/lab.pyscripts/tri_loop/t27b.py
User Scenarios
- Given the t27b steward tool's pure functions (
honest,delta,ratchet) have existing fixtures, When a developer writes a.t27spec for one of these functions and runst27c gen-rust, Then the generated Rust code passes the existing fixture tests without hand-written Rust. - Given the t27b CLI entry points (
status|doctor|delta|ratchet) are invoked viatri t27b, When the spec for a command is complete and generated, Thentri t27b <command>produces identical output to the current Python implementation. - Given the Railway lab (
contrib/railway/t27b-lab/lab.py) exercises t27b stages, When all stages have.t27specs withtestblocks, Thenlab.pycan be replaced by a.t27spec that drives the same verification.
Requirements
- FR-001: Each t27b stage (front, lower, ir, codegen/a64, macho) MUST have a corresponding
.t27spec file containingtestblocks. - FR-002: The steward tool's pure functions (
honest,delta,ratchet) MUST be the first stages ported to.t27specs witht27c gen-rustoutput. - FR-003: Generated Rust code from
.t27specs MUST pass all existing fixture tests incli/t27b/tests/*.rswithout modification. - FR-004: The Python CLI in
scripts/tri_loop/t27b.pyMUST be replaceable by generated code from.t27specs such thattri t27b status|doctor|delta|ratchetbehaves identically. - FR-005: The Railway lab in
contrib/railway/t27b-lab/lab.pyMUST be expressible as a.t27spec that drives the same stage verification. - FR-006: Any capability not yet expressible in
gen-rustMUST be filed as a blocker in epic epic: self-host t27c -- rewrite the compiler from Rust into t27 #5980 rather than worked around with hand-written code. - FR-007: The hand-written remainder in
AGENTS.mdMUST only shrink as stages are ported; no new hand-written files MAY be added to t27b. - FR-008: The mounted
bootstrap/src/compiler.rsvia#[path]incli/t27b/src/*.rsMUST be eliminated once the corresponding stage has a.t27spec.
Reactions are currently unavailable
Activity
feat(t27b): tri t27b reduce -- ddmin repro reducer with a reference g…
gHashTag commentedon Oct 7, 2026
a64.rs slice: PR #7535 (issue #7531).
The A64 encoders, their enums and constants, and the two patch helpers now come from
specs/tri/t27b/a64.t27through gen-rust.ec5c3cf78match exactly:t27b asmoutput is byte-identical for all 995 passing files.What remains hand-written in
cli/t27b/src/a64.rs:impl Cond { invert, name, from_bits }. gen-rust emits noimplblocks.bitmask_immandlogic_imm. They return an optional and are blocked by gen-rust: a value returned from a ?T fn is not wrapped in Some, so rustc rejects it (E0308) #7534.mov_imm, which pushes into&mut Vec<u32>.xr,disasm,disasm_fp,decode_bitmask.Gaps filed under #5980: #7532, #7533, #7534.
gHashTag commentedon Oct 7, 2026
gen-rust now wraps a value returned from a
?Tfn inSome(..)(#7534, PR #7536, auto-merge on). Once #7536 merges,bitmask_imm/logic_immfromcli/t27b/src/a64.rscan be ported as?Tfns. They are not ported in #7536. #7533 (a trailing@panicemitted asreturn @panic(...)) is in the Zig emitter and is still open.policy: list cli/t27b/src/macho.rs for the Mach-O port slice (Refs #7526
t27b: the A64 instruction encoders come from specs/tri/t27b/a64.t27 (C…
t27b: the Mach-O object layout and bytes are a t27 spec (Closes #7526) (
t27b: bitmask_imm, logic_imm and mov_imm come from specs/tri/t27b/a64…
t27b: the greedy blockers order, its replay and FNV-1a come from spec…
4 remaining items
t27b: the comptime_float arithmetic of lower_float.rs moves to specs/…
t27b: the type-text rules of lower.rs move to specs/tri/t27b/type_tex…
Merge master f21a0b3 into t27b-unread-anytype; CmpOp's tables move to…
Merge master f21a0b3 into t27b-const-div; ArithOp's tables move to ar…
Merge master f21a0b3 into t27b-int-cast-index-7902; can_widen_from is…
Merge master f21a0b3 into t27b-repeat-local-7909; no hand lines added (…
t27b: the source-text rules of lower.rs move to specs/tri/t27b/source…
t27b: the body walks of lower.rs move to specs/tri/t27b/ast_walk.t27 (C…
t27b: the node scans of lower.rs move to specs/tri/t27b/ast_scan.t27 (C…
t27b: the node shapes and item scans of lower.rs move to specs/tri/t2…