## 🔍 調査結果 ### ✅ 確認事項 - **本物の実装が呼ばれている**: SENTINEL出力で確認済み - 🔥 SENTINEL_SKIP_WS_CALLED!!! - 🎯 SENTINEL_KW_BOUNDARY_BEFORE_CALLED!!! - 🎯 SENTINEL_KW_BOUNDARY_AFTER_CALLED!!! - 🔤 SENTINEL_IS_IDENT_CHAR_CALLED!!! ### 🐛 重大バグ発見 **症状**: `FuncScannerBox.skip_whitespace` 内の `loop(1 == 1)` が実行されない **証拠**: ``` [skip_ws] START idx=10 s.length()=173 [skip_ws] i=10 n=173 [skip_ws] RETURN i=10 ← ループボディが実行されず即座にreturn ``` - `[skip_ws] LOOP-TOP i=10` が**一度も出力されない** - loop(1 == 1) の無限ループすら実行されない **影響範囲**: - box_name抽出失敗(空文字列) - defs生成失敗(defs_len=0) - canary テスト失敗 **問題の本質**: - using 経由で読み込まれたモジュールの static box 内 - 静的メソッド呼び出し (`FuncScannerBox.skip_whitespace(...)`) - loop 構文が VM/MIR レベルで実行されない ## 🔧 修正内容 1. **センチネル追加**: 4箇所に明確な出力追加 - skip_whitespace, kw_boundary_before, kw_boundary_after, is_ident_char 2. **呼び出し修正**: `me.scan_all_boxes` → `StageBFuncScannerBox.scan_all_boxes` ## 📊 次のステップ VM/MIR レイヤーでの loop 構文実装確認が必要 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Hakorune Lang Line — Rust-less Kernel (C ABI)
Scope
- This
lang/tree hosts the script-driven C ABI kernel artifacts for Phase 20.9+. - Goal: keep the runtime data plane callable without Rust on the hot path (Hakorune → LLVM → C ABI).
Principles
- Separation: do not mix Rust crates or cargo-specific layout under this tree.
- Ownership & ABI:
- Any
char*returned across the ABI is owned by the callee and must be freed viahako_mem_free(). - Do not mix CRT
free()across boundaries.
- Any
- Fail‑Fast: no silent fallbacks. Missing symbols must be observable via short diagnostics.
Layout (initial)
c-abi/— C shim(s) and headers for the minimal kernel surfaceREADME.md— responsibilities, build notes, platform caveatsinclude/— public headers (mirrored or thin wrappers)shims/— libc-backed shim(s) for canaries and local testing
Build & Link (dev)
- C shim: build a shared library to satisfy symbols for the LLVM line canaries.
- Link flags example:
- Linux:
-L$(pwd)/target/release -Wl,-rpath,$(pwd)/target/release -lhako_kernel_shim
- Linux:
Non‑Goals
- Plugin loader, HostBridge router, Box/Type system — kept in Rust.
Selfhost Launcher (AOT)
Dev line (Stage1 core – experimental)
- Dev build:
tools/selfhost/build_stage1.sh→ producestarget/selfhost/hakorune - Role:
- Fast iteration用の Stage1 selfhost バイナリ(Ny Executor / CLI 実験など)。
- new CLI/runner 機能はまずこちらで開発・検証する。
Stable line (lang bin – snapshot)
- Stable binary:
lang/bin/hakorune - Build (pure-lang launcher, legacy bring-up):
lang/build/build_runner.sh→ produceslang/bin/hakorune- Requirements: LLVM 18 dev (
llvm-config-18)
- Policy(Phase 25.1 以降の想定):
target/selfhost/hakoruneで十分に安定したら、その成果物をlang/bin/hakoruneに昇格させる(手動コピー or 専用スクリプト)。lang/bin/hakoruneは「last known good」の Stage1 コア EXE として扱い、配布や外部からの参照時は原則こちらを基準にする。
Notes
lang/以下は「最終的に 1 つの Stage1 コア EXE(hakorune)を構成するソース群」という前提で整理する。target/selfhost/hakoruneは開発中の最新版、lang/bin/hakoruneは安定版スナップショットという役割分担にする。