ReviewOS

home-lang/home

Parser: lex `#` and `'\'` characters; `[*T; N]` array-of-pointer-element type

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

Context

Two small parser additions surfaced by the 2026-05-05 audit. Combined ~9 home-os kernel modules unblocked.

Sub-item A: lex `#` and `'\'` characters (5 files)

Files: `kernel/src/arch/arm64/rpi/*.home` and `kernel/src/drivers/keyboard.home` use `#` (likely as ARM immediate prefix) and `'\'` (escaped backslash char literal) and the lexer rejects them.

Examples:

  • `mov x0, #0` (inside an asm block — likely tokenized normally)
  • `'\\'` (backslash char literal)

Inspect the cited files to see exactly what shape is rejected. Decide:

  • Lexer fix to recognize # in expression-position contexts
  • Lexer fix for '\\' char literal (escape sequence in char literal)
  • OR kernel codemod (rewrite to whatever idiom is canonical in Home)

Sub-item B: `[*T; N]` array-of-pointer-element type (4 files)

Distinct from `[*]T` (many-pointer, fixed in home #29). The `[*T; N]` form is an array of N pointer-to-T elements:

struct PageDir {
  entries: [*Entry; 512]    // array of 512 pointers to Entry
}

Currently fails in the parser. Fix: extend the array type parser to accept pointer types as element types. Probably ~5-10 lines in parseTypeAnnotation.

Why this matters

~9 modules unblocked. Both are small surgical parser additions.

Reference

  • 2026-05-05 audit: `~/Desktop/home-os-kernel-audit-2026-05-05.tsv`
  • Related (but distinct): home #29 `[*]const T` many-pointer

Sign in to comment on this issue.