cli: add whole-value linear aggregates

Implement STD-5 through source, AIR, verifier and deterministic interpreter.
Constructors consume nested owners; exhaustive unpack/take, explicit swap and
own.pack preserve ownership on success and failure. Support owning Option and
Result while keeping classification helpers Copy-only. Preserve borrow identity
across whole replacement and collection; distinguish individual owned arrays
from repeated heap arrays.

Specify feature contracts, invariants, diagnostics, compatibility and measured
source/AIR budgets in RFC 0023 and normative docs. Add canonical round trips,
AIR/source acceptance and rejection fixtures, CLI integration and CI checks.

Validate build, unit/extended tests, full conformance, forced-collection schedule
stress (32 seeds per quantum), hosted smoke, CLI suites, source coverage (88/88),
formatting and reference bundle generation. Source bundle grows 3.2%; Quick
Reference grows 4.0%. No MCC improvement is claimed.

Dynamic initialized linear buffers and explicit drain remain Q-036/STD-6;
frame/region/repeated heap storage is Copy-only. RFC remains Proposed.
This commit is contained in:
dev committed 2026-10-06 21:23:52 +03:00
1 parent 7eea31518d
commit 4f084decce
109 files changed
+1814 -142

No files matched your search

+20 -6
View File
@@ -331,11 +331,14 @@ const Parser = struct {
if (isWord(t, "let")) {
_ = p.next();
var names: std.ArrayList([]const u8) = .empty;
if (p.peek().tag == .l_paren) {
const tuple = p.peek().tag == .l_paren;
if (tuple) {
_ = p.next();
try names.append(p.arena, try p.ident("a name"));
_ = try p.expect(.comma, "`,`");
try names.append(p.arena, try p.ident("a name"));
while (p.peek().tag != .r_paren) {
try names.append(p.arena, if (p.peek().tag == .underscore) p.next().text else try p.ident("a name"));
if (p.peek().tag != .comma) break;
_ = p.next();
}
_ = try p.expect(.r_paren, "`)`");
} else try names.append(p.arena, try p.ident("a name"));
var ty: ?ast.Type = null;
@@ -346,7 +349,7 @@ const Parser = struct {
_ = try p.expect(.eq, "`=`");
const e = try p.expr();
_ = try p.expect(.semicolon, "`;`");
return .{ .span = p.span(start), .kind = .{ .let = .{ .names = names.items, .ty = ty, .e = e } } };
return .{ .span = p.span(start), .kind = .{ .let = .{ .names = names.items, .ty = ty, .e = e, .tuple = tuple } } };
}
const unchecked_borrow = isWord(p.peekAt(1), "unchecked") and p.peekAt(2).tag == .ident and p.peekAt(3).tag == .eq;
if ((isWord(t, "ref") or isWord(t, "mut")) and ((p.peekAt(1).tag == .ident and p.peekAt(2).tag == .eq) or unchecked_borrow)) {
@@ -822,6 +825,17 @@ const Parser = struct {
.l_bracket => {
_ = p.next();
const e = try p.expr();
if (p.peek().tag != .semicolon) {
var items: std.ArrayList(ast.Expr) = .empty;
try items.append(p.arena, e);
while (p.peek().tag == .comma) {
_ = p.next();
if (p.peek().tag == .r_bracket) break;
try items.append(p.arena, try p.expr());
}
_ = try p.expect(.r_bracket, "`]`");
return .{ .span = p.span(start), .kind = .{ .array_list = items.items } };
}
_ = try p.expect(.semicolon, "`;` in `[e; N]`");
const n = try p.expect(.int, "array length");
_ = try p.expect(.r_bracket, "`]`");
@@ -853,7 +867,7 @@ const Parser = struct {
};
return .{ .span = p.span(start), .kind = .{ .match_expr = try p.box(ast.Match, .{ .scrutinee = scrut, .arms = as, .span = p.span(start), .kind = kind }) } };
}
if (isKeyword(t.text)) return p.fail(t, "an expression");
if (isKeyword(t.text) and !(isWord(t, "struct") and p.peekAt(1).tag == .dot and isWord(p.peekAt(2), "unpack"))) return p.fail(t, "an expression");
_ = p.next();
if (p.peek().tag == .colon_colon and p.peekAt(1).tag != .lt) {
_ = p.next();