Repository navigation
t27o: Zig front end, step 1 -- zig_convert.t27 converts tier-1 fns and containers and translates the file's own tests into the oracle (Closes #10765) - #10819
Merged
Conversation
gHashTag
marked this pull request as draft
October 19, 2026 03:40
This was referenced Oct 19, 2026
Owner
Author
|
Review (orchestrator, Opus) -- held as a draft on purpose until #10817 merges:
|
9 of 12 tasks
This was referenced Oct 19, 2026
Contributor
This was referenced Oct 19, 2026
Merged
3 tasks
This was referenced Oct 19, 2026
Merged
Merged
…parse of trinity and trios converts 1160 fns (Closes #10765) The Zig front end reads scalar and slice fns, scalar and array consts and test blocks, writes the t27 spec, and refuses the rest with its reason. 35 tests, 0 vacuous; the glue is one mount line and one dispatch clause in cmd_t27o. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t, unbraced else, multi-object for, module names; 41 tests (Closes #10765) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…enum or union are read one by one as Container_name (Closes #10765) A struct of fns and consts is a namespace; one with fields is a type, refused as such, and its static fns still convert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of tri t27o says what a .zig file gets (Closes #10765) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
force-pushed
the
t27o/zig-front-10765
branch
from
October 19, 2026 06:53
0671d4c to
f3e5558
Compare
gHashTag
marked this pull request as ready for review
October 19, 2026 06:54
gHashTag
enabled auto-merge (squash)
October 19, 2026 06:54
Owner
Author
|
#10817 and #10883 have merged, so the hold is released: rebased onto master (f3e5558), |
This was referenced Oct 19, 2026
Contributor
PR DashboardGenerated at: 2026-10-19 07:10:02 UTC
Summary
Seal Status
|
This was referenced Oct 19, 2026
gHashTag
added a commit
that referenced
this pull request
Oct 19, 2026
… not the next line's (Closes #10936) (#10950) #10819 wrote the SPICE and Zig mounts of cli/tri/src/main.rs as `#[path = ".."] #[allow(..)] mod spice; // ..` on one line. edges_from() stored the path and skipped the rest of the line, so `mod spice;` and `mod zig;` were never read and the stored path landed on `mod renum;`: renum.rs (26 tests) was reported orphaned and the reachability check went red on master. After a #[path] attribute the rest of the same line is now read for a `mod` declaration. The existing test a_path_attribute_does_not_carry_to_a_later_unrelated_mod takes the one-line form and asserts the same-line binding; with the old parser it fails. `tri mods orphan --gate` on master: cli/tri 54 of 54 compiled, 0 orphaned. Hand lines +6/-6. Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
specs/tools/t27o/zig_convert.t27, the third t27o front end besiderust_convert.t27andspice_convert.t27, reached astri t27o <file>.zig. Step 1 of #10597 (option B of #10522): it converts the tier-1 functions of a Zig file and translates the file's owntestblocks into t27testblocks, whicht27b testthen runs as the oracle. Everything else is refused with its reason, never approximated; a refused item is a comment where it stood (// t27o: refused fn X (line N): <kind>at line M) and the last line is the Rust front end's count line. Closes #10765.What converts
u8..u64 i8..i64 usize isize bool f32 f64) and slice / array parameters and a scalar or void result; file-level scalar and array consts;testblocks.: (step), for over a slice, a range or several objects, switch (an if chain as a statement, a switch as a value), return / break / continue,@as @intCast @floatCast @floatFromInt @intFromFloat @intFromBool @sqrt @floor @ceil @round @exp @log @cos @abs @min @max @divTrunc @rem @mod,std.mathconstants and the calls with a measured t27 form,std.mem.eql(u8, ..),std.debug.assert.Container_name(as the Rust front end names a methodType_method);Container.f(..)and the bare calls between members are rewritten. A struct with only fns and consts is a namespace; one with fields is a type, refused as such, and its static fns still convert while each method is refused for the type it takes.expectEqual(e, a)isassert(a == e),expect(c)isassert(c),expectApproxEqAbs/Rel,expectEqualStrings,expectEqualSlices(u8, ..); a test that calls a refused fn is refused with it (passes until no new name is refused)..vibee, "generated", "do not edit", any case) is refused whole: "generated; convert its source spec instead" (the owner's rule for t27o: a Zig front end (zig_convert.t27) -- 36,495 Zig fns on the roadmap repos, 10-38 % in a first subset, tests as the oracle (stage 5) #10597, 2026-10-19).Where it departs from the issue text, and why (each measured under t27b and t27c)
while (c) : (i += 1)keeps its step: t27 reads it as Zig does, and moving it to the end of the body would be skipped by acontinue.<<=>>=+%=-%=*%=, no multi-objectfor, no[_]T{..}expression, no0o, no\r \xin strings, no switch prong list or range or char prong in a value switch: each is rewritten (x = x << e, an index loop, a typed declaration with the array declared on the line ahead, decimal) or refused with its kind._ = x;is accepted by t27b only for a parameter, so it is dropped for a local or a const (neither backend minds an unused name).@abs, an integer@minbeside a literal, a float@rem, a literal operand of@exp @floor @ceil @round @cos, a builtin on a const inside a file-level const, an@intCastshift count.@truncateis refused because t27'sastraps on a signed source (-1 as u8) where@truncatewraps.Tests
45 tests in the spec, 0 vacuous (
t27b test: 45 passed;t27c test-report: 45 of 45, vacuous passes 0 of 45). One test per rule with the refused neighbour as its negative control: every refusal kind, the cascade in any order, generated markers in any case and at line 20 vs 21, CRLF, a name table too small, an output buffer too small, a state vector shorter than the fixed slots, 20000-test files kept linear by a hash of the test names.Measurement (trinity
0770abb99src/, 2,226 tracked .zig; trios483dd9eecrates/, 347)std.testing.allocator)The 9 failing specs fail because the original tests do: lucas, baryon_formulas, spectrum and csv_parser fail under real
zig testtoo (Zig 0.16.0). Of 120 sampled specs,t27b testandt27c test-report(the Zig backend) agree on all 120. Of 150 sampled passing specs,zig teston the original file passes 42, does not compile under 0.16 for 108 (std API drift) and contradicts none. 1,800+ truncation / mutation / tiny-buffer runs of a debug build panic nowhere.Largest remaining refusals among the test-called tier-1-like bodies:
std.math.pow103 (t27b has no f64 routine), uses of a refused name 130 (mostly consts imported from other files,const PHI = sacred.PHI),std.debug.print/ fs 31,@Vector/@memset/@bitCast36, mutable file-level vars 18.Hand lines (own-language)
cli/tri/src/main.rs: +5 -5, net 0 -- the mount is one line (the SPICE mount's two lines became one), the dispatch is a clause of the existinglet n = ..line, the help sentence is an addition to the existing doc line. The budget check from the base reads rc=0.Not in this PR
tri t27o-sweepdoes not yet list.zig(ledger.t27 is not touched);--oracle/--checkare for Rust (a.zigfile prints its spec). After a rebase onto a newerrust_convert.t27the seal's closure hash needst27c seal specs/tools/t27o/zig_convert.t27 --saveagain.🤖 Generated with Claude Code