## Phase 146 P0: ANF Routing SSOT Unified **Goal**: Unify ANF routing in `lower_expr_with_scope()` L54-84, remove legacy lowering **Changes**: - expr_lowerer_box.rs: Added scope check (PureOnly → skip ANF, WithImpure → try ANF) - post_if_post_k.rs: Removed legacy inline lowering (L271-285), added `lower_condition_legacy()` helper - contract.rs: Already had `CondLoweringFailed` out-of-scope reason **Test Results**: ✅ Phase 146 P0 smoke (exit 7), 0 regressions ## Phase 146 P1: Compare Operator Support **Goal**: Enable ANF for condition expressions with Compare operators **Changes**: - joinir_dev.rs: Added `anf_allow_pure_enabled()` (HAKO_ANF_ALLOW_PURE=1) - expr_lowerer_box.rs: PureOnly scope ANF support (L56-66) - execute_box.rs: Compare operator support (+122 lines) - `execute_compare_hoist()`, `execute_compare_recursive()`, `ast_compare_to_joinir()` - Extended `normalize_and_lower()` for Compare **Test Results**: ✅ Phase 146 P1 smoke (exit 7 with flags), 0 regressions ## Phase 147 P0: Recursive Comparison ANF **Goal**: Extend recursive ANF to Compare operators **Changes**: - contract.rs: Added `AnfParentKind::Compare` variant - plan_box.rs: Compare case in BinaryOp routing (L68-79, L134-139) - Distinguishes Compare vs arithmetic BinaryOp **Benefits**: Enables recursive ANF for comparisons - `s.length() == 3` → `t = s.length(); if (t == 3)` ✅ - `s1.length() < s2.length()` → `t1 = s1.length(); t2 = s2.length(); if (t1 < t2)` ✅ ## Implementation Summary **Files Modified** (9 files, +253 lines, -25 lines = +228 net): 1. src/config/env/joinir_dev.rs (+28 lines) 2. src/mir/control_tree/normalized_shadow/anf/contract.rs (+2 lines) 3. src/mir/control_tree/normalized_shadow/anf/execute_box.rs (+122 lines) 4. src/mir/control_tree/normalized_shadow/anf/plan_box.rs (+18 lines) 5. src/mir/control_tree/normalized_shadow/common/expr_lowerer_box.rs (+18 lines, -0 lines) 6. src/mir/control_tree/normalized_shadow/post_if_post_k.rs (+44 lines, -25 lines) 7. CURRENT_TASK.md 8. docs/development/current/main/10-Now.md 9. docs/development/current/main/30-Backlog.md **Files Created** (7 files): - apps/tests/phase146_p0_if_cond_unified_min.hako - apps/tests/phase146_p1_if_cond_intrinsic_min.hako - tools/smokes/.../phase146_p0_if_cond_unified_vm.sh - tools/smokes/.../phase146_p0_if_cond_unified_llvm_exe.sh - tools/smokes/.../phase146_p1_if_cond_intrinsic_vm.sh - tools/smokes/.../phase146_p1_if_cond_intrinsic_llvm_exe.sh - docs/development/current/main/phases/phase-146/README.md **Acceptance Criteria**: ✅ All met - cargo build --release: PASS (0 errors, 0 warnings) - Phase 145 regressions: PASS (exit 12, 18, 5) - Phase 146 P0: PASS (exit 7) - Phase 146 P1: PASS (exit 7 with HAKO_ANF_ALLOW_PURE=1) **Architecture**: - SSOT: ANF routing only in `lower_expr_with_scope()` L54-84 - Box-First: Phase 145 `anf/` module extended - Legacy removed: post_if_post_k.rs unified with SSOT 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
📚 Nyash Documentation
🚀 はじめに(導線)
- 現在のタスクと進行状況: ../CURRENT_TASK.md
- コア概念の速習: reference/architecture/nyash_core_concepts.md
- 設計ブループリント(文字列/文字コード): development/design/blueprints/strings-utf8-byte.md
📂 ドキュメント構造(指針)
📖 reference/ - 正式な技術仕様
- language/ - 言語仕様(構文、型システム、Box仕様)
- architecture/ - システムアーキテクチャ(MIR、VM、実行バックエンド)
- api/ - ビルトインBoxのAPI仕様
- plugin-system/ - プラグインシステム、BID-FFI仕様
- 🆕🔥 TypeBox ABI統合 + セルフホスティング - ABIすらBoxとして扱う革命的設計!
- まずはこちら:
reference/boxes-system/plugin_lifecycle.md(PluginBoxV2のライフサイクル、singleton、nyash.tomlの要点)
📚 guides/ - 利用者向けガイド
- getting-started.md - はじめに(統一版)
- tutorials/ - ステップバイステップのチュートリアル
- examples/ - 実践的なサンプルコード
- wasm-guide/ - WebAssemblyビルドガイド
🧩 how-to/ - 目的別ハウツー
- 手順重視の短いガイド(前提→コマンド→検証)
🔧 development/ - 開発者向け
- current/ - 現在進行中のタスク(CURRENT_TASK.md等)
- roadmap/ - 開発計画
- phases/ - Phase 8~12の詳細計画
- phase-12/ - 🆕🔥 TypeBox統合ABI + Nyash ABI C実装(セルフホスティング実現!)
- native-plan/ - ネイティブビルド計画
- proposals/ - RFC、新機能提案
🔌 Net Plugin(HTTP/TCP)
- 使い方と仕様:
reference/plugin-system/net-plugin.md
🗄️ archive/ - アーカイブ
- consultations/ - AI相談記録(gemini/chatgpt/codex)
- decisions/ - 過去の設計決定
- build-logs/ - ビルドログ、ベンチマーク結果
- old-versions/ - 古いドキュメント
📌 Docs マップ(トップレベルとステータス)
新しくドキュメントを書くときや、どこに置くか迷ったときはこの表を基準にする。
| パス | 用途 | 主な対象 | ステータス |
|---|---|---|---|
reference/ |
言語仕様・正式なリファレンス | 利用者 / 実装者 | Active / SSOT |
guides/ |
チュートリアル・長めの読み物 | 利用者 / 新規開発者 | Active |
how-to/ |
手順書・レシピ集 | 日常開発 | Active |
quick-reference/ |
コマンドやオプションの早見表 | 日常参照 | Active |
development/ |
Rust 実装側の設計・ロードマップ | コア開発者 | Active(Rust層) |
private/ |
将来の整理待ちのメモ・長文案 | コア開発者 | Draft / Incubator |
design/ |
公開可能な安定寄り設計ノート | 実装者 | Active(安定設計) |
architecture/ |
全体アーキテクチャの俯瞰図 | 実装者 / 設計者 | Active |
abi/ |
Nyash/Hakorune ABI 関連 | 実装者 | Active |
specs/ |
古めの仕様・実験的仕様 | 実装者 | Legacy(必要に応じ参照) |
checklists/ |
レビュー・設計チェックリスト | 実装者 | Active |
tools/ |
ドキュメント生成・補助スクリプト | 実装者 | Active |
updates/ |
リリースノート・変更履歴 | 利用者 / 実装者 | Active |
releases/ |
リリース関連ドキュメント | 利用者 | Active |
archive/ |
旧ドキュメント・歴史資料 | 研究・考古学用 | Archived(正本ではない) |
assets/ |
画像などの共有アセット | すべて | Support |
ENV_VARS.md |
環境変数リファレンス | 実装者 / 運用者 | Active(集約先) |
運用ルール(提案):
- 新規仕様/設計: まずは
private/に置き、安定したらreference/ordesign/へ昇格する。 - Rust 実装寄りの話:
development/配下に置く(セルフホスト側はprivate/roadmap等)。 - 古い資料・置き換え済み: 内容を変えずに
archive/以下へ移動し、先頭に「Archived / 新しい場所」の一行メモを書く。 - ユーザー向けに見せたいもの:
guides/,how-to/,quick-reference/,releases/を優先する。
🎯 クイックアクセス
すぐ始める
- guides/getting-started.md
- guides/language-guide.md
- guides/p2p-guide.md
技術リファレンス
- reference/language/LANGUAGE_REFERENCE_2025.md
- reference/language/EBNF.md(演算子: ! 採用 / do-while 非採用)
- reference/language/strings.md(UTF‑8/Byte 二本柱)
- reference/architecture/TECHNICAL_ARCHITECTURE_2025.md
- reference/architecture/execution-backends.md
- reference/runtime/gc.md
- reference/plugin-system/
- tools/cli-options.md(CLI早見表)
デザイン/ガイド
- guides/language-core-and-sugar.md(コア最小+糖衣)
- guides/loopform.md(ループ正規化)
- guides/scopebox.md(開発時の可視化)
- guides/dev-local-alias.md(開発向け: 行頭 @name = expr → local 宣言糖衣)
- guides/box-patterns.md(Boxパターン集:Ownership/Lease/Cancel/Capability/Affinity/Observable)
- guides/box-design-checklist.md(Box 設計チェックリスト)
- proposals/concurrency/boxes.md(並行モデルのBox設計:Routine/Channel/Select/Scope)
- reference/concurrency/semantics.md(ブロッキング/close/select/観測の規約)
- design/(設計ノート入口)
- development/design/legacy/flow-blocks.md(矢印フロー/匿名ブロック・設計草案)
- development/proposals/scope-reuse.md(スコープ再利用ブロック・MVP提案)
- reference/language/match-guards.md(ガード連鎖/Range・CharClass設計)
- guides/core-principles.md(最小構文・ゼロランタイム・可視化の原則)
開発状況
- 現在のタスク
- 開発ロードマップ
- Phase別計画
- 🔥 Phase 12: TypeBox統合ABI
- 🔥 Phase 16: マクロ革命
- 🧪 Phase 17: LoopForm Self‑Hosting
- 💡 Rust所有権統合(候補) - Phase 17+候補
- 🧩 Mini‑VM 構築ロードマップ
- 🧭 Using→Loader 統合(最小設計): development/design/legacy/using-loader-integration.md
- 🗂️ Docsの書き方(小さく・リンク駆動): guides/contributing-docs.md
📋 再編成について / フォルダの見分け方
ドキュメントは2025年8月20日に再編成されました。詳細はREORGANIZATION_REPORT.mdを参照してください。
旧パスから新パスへの主な変更:
説明書/→guides/とreference/に分割予定/→development/roadmap/- 散在していたファイル → 適切なカテゴリに整理
補足:
reference/は正本(仕様)。guides/は読み物、how-to/は手順書。design/は公開できる設計ノート。private/は下書き保管庫(将来reference//design/に昇格)。
Nyash は「Everything is Box」哲学に基づく言語です。詳細はコア概念とガイドを参照してください。