Files
hakorune/docs/private/roadmap/phases/phase-20.20/PLAN.md

42 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Phase 20.20 — 実装計画C ABI Export / LLVM
マイルストーン
- M1: 注釈→MIR JSON 反映(@extern_c
- M2: LLVM(IR) C ABI ラッパ生成(プリミティブ i64/i32
- M3: C ヘッダー生成extern "C"、stdint.h
- M4: 最小スモーク(.o + .h → C からリンク実行)
- M5: ドキュメント(設計/制約/使用例)
タスク(詳細)
1) 注釈設計と反映M1
- [ ] @extern_c("c_symbol") の構文/意味論を docs に定義
- [ ] パーサ→ビルダーで関数メタへ注釈を格納
- [ ] MIR JSON に `function.flags.extern_c = "c_symbol"` を出力
2) C ABI ラッパ生成M2
- [ ] llvmlite builder に `emit_c_abi_function(func_name, c_name)` を追加
- [ ] calling convention=ccc、unmangled 名、visibilityELF/MachO/Win
- [ ] プリミティブ i64/i32 のみ対応fail-fast: その他は未対応メッセージ)
3) ヘッダー生成M3
- [ ] CHeaderGenerator を実装MIR JSON→.h 生成)
- [ ] extern "C"、include guard、stdint.h、プロトタイプ
- [ ] 型マッピング表SSOTに基づき生成当面: i64→int64_t、i32→int32_t
4) スモークM4
- [ ] Hakorune → MIR(JSON) → .oC ABI→ C からリンク→実行
- [ ] 代表: `test_add(10,20)=30`、負/ゼロ境界
5) ドキュメントM5
- [ ] docs/development/abi/README.md設計/制約/CLI
- [ ] docs/development/abi/types.md型マッピングSSOT
- [ ] tools最小ビルド/リンク例)
ガード/ポリシー
- 既定 OFFCLIフラグ: `--emit-c-abi`, `--emit-header`
- ENV は原則導入しない。必要時のみ TTLドキュ必須
- 失敗は FailFastラッパ生成前に診断
見積
- 実装 + スモーク + ドキュ: 23週間最小構成