P6A-8: Source Reference Bundle and harness profile aji_source
- source bundle: a /docs directory with QUICK.md (Quick Reference plus a where-to-read table), language/*.md, diagnostics/errors.md and the AIR bundle only under air/; built from docs/agent/source-bundle.txt (> output files, @manifest includes) by zig build agent-reference - Quick Reference examples are checked: every aji block must be an excerpt of a conformance program in tests/conformance/source/quickref (zig build test fails otherwise); QR fixes found by the check (mut d = data, region not auto-borrowed, statement/borrow blocks that could not verify, io_error match) - frontend: task.*/channel.*/mutex.* are not-yet-implemented, not E7006 - aji lower --stats: mechanical_air_eliminated_raw and _normalized (each byte-string materialization counted as one constant; spec 15 §11) - harness: profile aji_source (doc_groups), per-file and per-group docs metrics on distinctive lines, profile columns (tool calls, lowered AIR raw/normalized, docs files read, IR-form and type-mismatch counts), dev-echo aji_source variant, scripted run and test, source token report - plan: P6A-8 done, P6A-9 criteria; Q-021/Q-022 resolved; unsafe block deferred
This commit is contained in:
1 parent
61be766634
commit
3e2d9b63a7
35 files changed
+1170
-106
No files matched your search
+15
-3
@@ -117,16 +117,28 @@ fn run(io: std.Io, arena: std.mem.Allocator, args: []const [:0]const u8, out: *s
|
||||
}.count;
|
||||
const sc = code(source);
|
||||
const ac = code(o.air);
|
||||
const nc = try aji.frontend.normalizedSize(arena, o);
|
||||
const ratio = struct {
|
||||
fn f(a: usize, b: usize) f64 {
|
||||
return @as(f64, @floatFromInt(a)) / @as(f64, @floatFromInt(@max(b, 1)));
|
||||
}
|
||||
}.f;
|
||||
var s: std.json.Stringify = .{ .writer = out };
|
||||
try s.write(.{
|
||||
.source_bytes = sc.bytes,
|
||||
.source_lines = sc.lines,
|
||||
.air_bytes = ac.bytes,
|
||||
.air_lines = ac.lines,
|
||||
.expansion_bytes = @as(f64, @floatFromInt(ac.bytes)) / @as(f64, @floatFromInt(@max(sc.bytes, 1))),
|
||||
.expansion_lines = @as(f64, @floatFromInt(ac.lines)) / @as(f64, @floatFromInt(@max(sc.lines, 1))),
|
||||
.air_bytes_normalized = nc.bytes,
|
||||
.air_lines_normalized = nc.lines,
|
||||
.byte_string_constants = o.constants.len,
|
||||
.expansion_bytes = ratio(ac.bytes, sc.bytes),
|
||||
.expansion_lines = ratio(ac.lines, sc.lines),
|
||||
// 1 − source/AIR: the share of AIR text the frontend writes for the author.
|
||||
.mechanical_air_eliminated = 1.0 - @as(f64, @floatFromInt(sc.bytes)) / @as(f64, @floatFromInt(@max(ac.bytes, 1))),
|
||||
.mechanical_air_eliminated_raw = 1.0 - ratio(sc.bytes, ac.bytes),
|
||||
// The same against AIR with each byte-string materialization counted
|
||||
// as one logical constant operation (spec 15 §11).
|
||||
.mechanical_air_eliminated_normalized = 1.0 - ratio(sc.bytes, nc.bytes),
|
||||
});
|
||||
try out.writeByte('\n');
|
||||
return .accepted;
|
||||
|
||||
Reference in new issue
Block a user