ReviewOS

home-lang/home-os

Codemod: replace `#` (line-comment / preprocessor) with valid Home syntax in 4 kernel files

#21
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Context

The 2026-05-06-evening audit shows 4 home-os kernel files failing with `Invalid character '#' in source code`:

  • `kernel/src/arch/arm64/rpi/boot.home`
  • `kernel/src/arch/arm64/rpi/devicetree.home`
  • `kernel/src/arch/arm64/rpi/mailbox.home`
  • `kernel/src/drivers/bluetooth/hci.home`

`#` is not valid in Home source. The kernel uses it C-preprocessor / Rust-attribute style.

Likely shapes

From scout analysis on similar files: `#` is used as Rust-style attributes (`#[naked]`, `#[no_mangle]`, `#[repr(C)]`, `#[link_section]`, etc.). Home has no attribute system so these need to be replaced or removed.

Could also be:

  • Line comments (rare — Home uses `//`)
  • Numeric literal prefixes (rare in Home)

Approach

For each file:

  1. Find each `#` occurrence
  2. Identify what it's trying to do
  3. Replace with valid Home syntax:
    • Remove if it was a Rust-style attribute that has no Home equivalent
    • Comment-out as `//` if it was a line comment
    • Convert as appropriate for other shapes

Verify post-fix with: ``` perl -e 'alarm 5; exec @ARGV' /Users/glennmichaeltorregosa/Documents/Projects/home/zig-out/bin/home-debug ast kernel/src/<file> ```

The `Invalid character '#'` error should be gone (other unrelated errors may remain).

Why this matters

4 modules unblocked. Mechanical cleanup. Pairs with home compiler #40 (reflection cluster) for combined +16 file gain.

Reference

  • 2026-05-06-evening audit: `~/Desktop/home-os-kernel-audit-2026-05-06-evening.tsv`

Sign in to comment on this issue.