Files
hakorune/docs/development/roadmap/phases/phase-22/README.md
Selfhosting Dev 187edfcaaf 🏗️ Phase 22: Revolutionary Nyash LLVM Compiler vision
- Create Phase 22 documentation for Nyash-based LLVM compiler
- C++ thin wrapper (20-30 functions) + Nyash implementation (100-200 lines)
- Gemini & Codex discussions: Both AIs confirm technical feasibility
- Build time revolution: 5-7min → instant changes
- Code reduction: 2,500 lines → 100-200 lines (95% reduction\!)
- User insight: 'Why worry about memory leaks for a 3-second batch process?'
- Ultimate 'Everything is Box' philosophy: Even the compiler is a Box\!

🌟 Vision: After Phase 15 LLVM stabilization, we can build anything\!
2025-09-12 04:03:43 +09:00

66 lines
2.4 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 22: Nyash LLVM Compiler - コンパイラもBoxの世界へ
## 📋 概要
LLVMコンパイラ自体をNyashで実装する革命的アプローチ。
C++で最小限のグルー層20-30関数を作り、コンパイラロジックの大部分をNyashで記述。
**究極の目標2,500行のRust実装を100-200行のNyashで置き換える。**
## 🎯 フェーズの目的
1. **開発サイクルの革命**: ビルド時間5-7分 → 即座の変更反映
2. **究極のシンプルさ**: Everything is Boxでコンパイラも簡潔に
3. **セルフホスティング深化**: NyashでNyashをコンパイルする真の実現
4. **保守性の劇的向上**: 誰でも読める100行のコンパイラ
## 🤔 なぜこのアプローチか?
### 現在の課題2025-09-11
- **Rust + LLVM (inkwell)**: 複雑で長いビルド時間
- **2,500行のコード**: 理解と保守が困難
- **依存地獄**: inkwellのバージョン管理
### ユーザーの洞察
「MIR解釈して出力するだけなのに、メモリーリークの心配なんてあるんだろうか
→ その通り短命なバッチ処理にRustの複雑さは過剰。
## 📐 設計概要
```nyash
// 究極のシンプルなLLVMコンパイラ
box LLVMCompiler {
context: LLVMContextBox
module: LLVMModuleBox
compileMir(mirJson) {
local mir = JsonBox.parse(mirJson)
mir.functions.forEach(me.compileFunction)
return me.module.emitObject()
}
}
```
## 🔗 関連ドキュメント
- [Geminiとの議論](gemini-discussion.md) - 技術的実現可能性
- [Codexとの議論](codex-discussion.md) - 詳細技術分析
- [統合まとめ](synthesis.md) - 両AIの知見を統合
- [実装ロードマップ](ROADMAP.md) - 段階的実装計画
## 📅 実施時期
- **開始条件**: Phase 15 LLVMバックエンド完成後
- **推定開始**: 2026年後半
- **推定期間**: 3-4ヶ月PoCは数週間
## 💡 期待される成果
1. **ビルド時間**: 5-7分 → ゼロ(スクリプト実行のみ)
2. **コード量**: 2,500行 → 100-200行95%削減!)
3. **理解容易性**: 週末どころか1時間で理解可能
4. **開発効率**: 即座に変更・テスト可能
## 🌟 夢の実現
> 「コンパイラもBox、Everything is Box」
> 「2,500行→100行、これこそ革命」
最小限のC++グルーとNyashの表現力で、世界一シンプルなLLVMコンパイラへ。