Context
The 2026-05-04-night audit's scout triage found that one grammar fix unblocks ~15-16 home-os kernel modules. All share a root cause: the parser doesn't accept Type { ... } (or module-qualified mod.Type { ... }) as a struct literal in expression position, and doesn't accept nested declarations (pub const, pub fn, enum, etc.) inside pub const Foo = struct { ... } bodies. Plus error { ... } error-set syntax falls under the same shape.
Affected patterns (all unblocked by this fix)
// Pattern 1: struct literal in return / let / var / const initializer
pub fn make() Foo { return Foo{ .x = 1, .y = 2 } }
let x = Foo{ .x = 1 }
var v = Foo{ .x = 1 }
pub const X = ns.Type { .x = 1 }
// Pattern 2: nested pub const / fn / enum inside struct body
pub const Foo = struct {
a: u32,
pub const MAX: u32 = 100 // currently fails: Expected '}' after struct fields
pub fn new(): Foo { ... }
pub const Bar = enum { ... }
}
// Pattern 3: error set
pub const E = error{
NotFound,
PermissionDenied,
}Affected files (15-16 total from audit)
P1 group: drivers/input/mouse.home, fs/btree_dir.home, fs/extents.home, fs/largefile.home, iot/audio_processing.home, net/bluetooth_pan.home, net/openvpn.home, net/wifi_hotspot.home, perf/rcu_tree.home, security/dm_verity.home, security/hardened_usercopy.home, security/keyring.home, security/ptr_migrate.home
P2 group: fs/sparse.home, iot/voice_routines.home, security/module_signing.home
Approach
In the parser:
- Struct literal in expression position: when an expression is being parsed and the lookahead is
IDENT { .field = ...(orIDENT { Variant1, Variant2 }for error sets), commit to struct-literal parsing. Module-qualified paths (a.b.Type { ... }) work the same way. - Nested decls in struct body: extend the struct-body parser to accept any of
pub const,pub fn,const,fn,enum,struct,typedeclarations interleaved with the field list. - Error sets:
error { Variant1, Variant2 }parses as a type expression. Result is an error-set type.
Why this matters
Highest-leverage parser fix on the table. ~15-16 home-os kernel modules unblocked.
Reference
- 2026-05-04-night audit:
~/Desktop/home-os-kernel-audit-2026-05-04-night.tsv - Scout triage report (in-conversation, 2026-05-04 evening)