Files
hakorune/tools/pyc/README.md
nyash-codex d7805e5974 feat(joinir): Phase 213-2 Step 2-2 & 2-3 Data structure extensions
Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization.

Changes:
1. PatternPipelineContext:
   - Added loop_condition: Option<ASTNode>
   - Added loop_body: Option<Vec<ASTNode>>
   - Added loop_update_summary: Option<LoopUpdateSummary>
   - Updated build_pattern_context() for Pattern 3

2. CarrierUpdateInfo:
   - Added then_expr: Option<ASTNode>
   - Added else_expr: Option<ASTNode>
   - Updated analyze_loop_updates() with None defaults

Status: Phase 213-2 Steps 2-2 & 2-3 complete
Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
2025-12-10 00:01:53 +09:00

25 lines
988 B
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.

# Nyash Python Compiler (Phase 10.7 Workbench)
目的: Parser(プラグイン) → Nyash側コンパイラ → Nyashソース → 既存AOT までの最短ルートを、Nyashだけで段階実装する作業場。
## 構成
- `pyc.hako` — エントリ(最小パイプライン実行)
- `PyCompiler.hako` — Nyash側コンパイラ本体C2で拡張
- `PyIR.hako` — IR生成/整形のヘルパ(最小)
## 使い方(最小)
```bash
# 1) NYASH_PY_CODE に Python コードを入れるParserプラグインが拾う
NYASH_PY_CODE=$'def main():\n return 0' \
./target/release/hakorune --backend vm tools/pyc/pyc.hako
```
出力
- Parser JSONdump/counts/unsupported
- 生成された Nyash ソース(現状は最小: return 0
## 次の拡張
- Parser JSON → IR(JSON) への変換def/return最小
- IR → Nyash 生成If/Return/Assign へ拡張)
- All-or-Nothing 運用unsupported_nodes を見て Strict に弾くスイッチ)