ReviewOS

home-lang/home

Parser: small additions — `orelse` operator, qualified array sizes, `align(N)` field, nested reflection

#30
Closed glennmichael123 opened this 24 days ago · 0 comments
24 days ago

Context

Five small parser fixes grouped together — each unblocks 1 file, all are small surgical additions. Bundle for ergonomic review.

Sub-items

1. orelse binary operator

let x = make() orelse return 0   // fails at orelse

Add orelse to the precedence table at the appropriate level (between equality and ??/?: per the language's null-safety operators in CLAUDE.md).

File: kernel/src/iot/conversation.home:271

2. Module-qualified array size [mod.IDENT]T

var x: [ns.MAX]u64;   // fails
var y: [MAX]u64;      // works (single identifier)

Allow member-access expression inside [...] array-size context. The size expression should parse with the full expression grammar, not just identifier-or-literal.

File: kernel/src/ml/tensor_ops.home:1140

3. align(N) field attribute

struct Foo { entries: [512]u8 align(4096) }

align(N) was added on declarations in #18; extend to struct field declarations too.

File: kernel/src/vmm.home:48

4. Nested reflection in argument position

@as(u6, @intCast(shift))   // fails — @intCast not recognized as expression in arg position

This is closely related to home #27 (missing reflection builtins). The fix in #27 should also cover this; verify the reflection-builtin path works for nested calls.

File: kernel/src/perf/flamegraph.home:399

5. Variadic args: ... parameter — DEFERRED

fn print_message(...) { ... }

File: kernel/src/i18n/messages.home:663. Single occurrence, design implications (variadic-arg semantics, ABI). Skip for this issue; file separately if needed later.

Why this matters

4 modules unblocked from small additions. Lower priority than the unified struct-body fix but cheap.

Reference

  • 2026-05-04-night audit
  • Scout triage report

Sign in to comment on this issue.