Files
hakorune/docs/development/roadmap/phases/phase-12.7/ancp-specs/ANCP-Reversible-Mapping-v1.md
Moe Charm 19f775c34d feat(phase12.7): 糖衣構文Phase 12.7-B完了 + 自律型AI開発システム制御機能
🚀 Phase 12.7-B: ChatGPT5糖衣構文(基本実装完了)
- パイプライン演算子(|>)実装
- セーフアクセス(?.)とデフォルト値(??)実装
- sugar gateによる段階的有効化機能
- 糖衣構文テストスイート追加

🤖 自律型AI開発システム改善
- codex-async-notify.sh: タスク制御指示追加
  - "下の箱を積み過ぎないように先に進んでください"
  - "フェーズが終わったと判断したら止まってください"
- プロセス数表示機能の改善(count_running_codex_display)
- 自動停止機能が正常動作(Phase 12.7-C前で停止確認)

📚 ドキュメント更新
- Paper 13: 自律型AI協調開発システムの革新性を文書化
- ANCP可逆マッピング仕様追加
- nyfmt PoC(フォーマッター)計画追加

🧱 箱理論の体現
- 74k行のコードベース(Phase 15で20k行を目指す)
- ANCP適用で最終的に6k行相当を狙う
- 世界最小の実用コンパイラへの道

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-05 05:16:21 +09:00

2.2 KiB
Raw Blame History

ANCP v1 Reversible Mapping (P0 subset)

Status: Preview (12.7C P0). Scope is the sugar subset already implemented and gated in 12.7B.

Goals

  • Provide a clear, reversible mapping between Nyash sugar and canonical forms.
  • Make roundtrip (original → canonical → ANCP → canonical → original) predictable for the subset.

Gating

  • Runtime sugar is gated by NYASH_SYNTAX_SUGAR_LEVEL=basic|full.
  • ANCP tools/nyfmt remain PoC/docs only at this stage.

Subset Mappings

  • Pipeline |>

    • Nyash: lhs |> f(a,b) → Canonical: f(lhs, a, b)
    • Nyash: lhs |> obj.m(a) → Canonical: obj.m(lhs, a)
    • Roundtrip invariant: No change of call order or arity.
  • Safe Access ?.

    • Nyash: a?.b → Canonical (peek): peek a { null => null, else => a.b }
    • Nyash: a?.m(x) → Canonical: peek a { null => null, else => a.m(x) }
    • Roundtrip invariant: No change of receivers/args; only the null guard appears.
  • Default ??

    • Nyash: a ?? b → Canonical (peek): peek a { null => b, else => a }
    • Roundtrip invariant: Both branches preserved asis.
  • Range ..

    • Nyash: a .. b → Canonical: Range(a, b)
    • Roundtrip invariant: Closed form preserved; no inclusive/exclusive change.
  • Compound Assign +=, -=, *=, /=

    • Nyash: x += y → Canonical: x = x + yx は変数/フィールド)
    • Roundtrip invariant: Operator identity preserved; left target identical.

Examples (Before / Canonical / RoundTrip)

  1. Pipeline + Default
Before:     data |> normalize() |> transform() ?? fallback
Canonical:  peek transform(normalize(data)) { null => fallback, else => transform(normalize(data)) }
RoundTrip:  data |> normalize() |> transform() ?? fallback
  1. Safe Access Chain
Before:     user?.profile?.name
Canonical:  peek user { null => null, else => peek user.profile { null => null, else => user.profile.name } }
RoundTrip:  user?.profile?.name
  1. Range + Compound Assign
Before:     i += 1; r = 1 .. 5
Canonical:  i = i + 1; r = Range(1, 5)
RoundTrip:  i += 1; r = 1 .. 5

Notes

  • Precise precedence handling is left to the parser; mappings assume already parsed trees.
  • Full ANCP compact tokens will be documented in a separate spec revision.