ReviewOS

home-lang/home

Parser grammar gaps surfaced by 2026-05-04 home-os audit

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

Context

The 2026-05-04 home-os kernel audit (post #16 parser-hang fix) classifies 151 of 405 modules as parse failures with concrete diagnostics. Three patterns dominate the parse-failure bucket and look like genuine grammar gaps in the parser:

# of filesPatternExample
27`Expected semicolon or newline between statements``arch/arm64/rpi3.home:320:20`
14`Expected enum name``drivers/platform/laptop.home`, `fs/partition.home`
13`Expected struct name``arch/x86_64/syscall_fast.home`, `debug/mem_footprint.home`

Total: 54 files (~13% of the kernel) blocked by these three diagnostic shapes.

Hypothesized causes

Expected enum/struct name (27 files combined)

Look at `enum Color: u8 { ... }` style declarations — the parser doesn't accept the explicit type-tag syntax after `enum` / `struct` names. Sample from `vga.home`:

```home enum Color: u8 { Black = 0 Blue = 1 ... } ```

The parser tokenizes `enum` then expects an identifier (the name) but finds `:` first — or finds the name and then chokes on the `: u8` tag.

Expected semicolon or newline (27 files)

Multiple distinct triggers blended together. Two confirmed shapes:

  • `inline fn name(): T { ... }` — `inline` modifier on function declarations
  • `var rx_buffer: [256]u8 = [_]u8{0} ** 256` — array repeat-init suffix `** N`

These probably hit different code paths; needs careful triage.

Why this matters

Each grammar-gap fix moves 10-30 modules from parse-fail to either typecheck-fail or OK in one shot. Not as cheap as the home-os #14 codemod (~40 modules), but each landed fix here is high-leverage and unlocks downstream type-checking visibility.

Proposal

Split into 2-3 sub-issues if useful, or one PR per gap. Suggested order:

  1. Enum/struct explicit-tag syntax (27 files unblocked) — likely a single small grammar addition; the lexer already produces the right tokens
  2. `inline fn` modifier
  3. ` N`** array-repeat-init suffix in type-position contexts (the `var rx_buffer` shape)

For each: add diagnostic snapshot test cases at `tests/diagnostics/cases/parse/` so the new acceptance is locked in.

Reference

  • 2026-05-04 audit TSV: `~/Desktop/home-os-kernel-audit-2026-05-04.tsv`
  • Ranked #2 in the audit's "biggest remaining bottleneck" list (after the home-os `= undefined` follow-up)

Sign in to comment on this issue.