feat(phase21.5): Stage-B parser loop fix + delegate path stabilization
## 修正内容 ### 1. Stage-B パーサー修正(偶然の回避) - **ファイル**: - `lang/src/compiler/parser/expr/parser_expr_box.hako` - `lang/src/compiler/parser/stmt/parser_control_box.hako` - **問題**: ネストループで gpos が正しく進まず、loop の cond/body が壊れる - **回避策**: new 式のメソッドチェーン処理追加で別ループを導入 - **結果**: MIR 生成が変わって VM gpos バグを回避 ### 2. delegate パス動作確認 - **テスト**: `/tmp/loop_min.hako` → rc=10 ✅ - **MIR構造**: 正しい PHI/compare/binop を生成 - **チェーン**: hakorune parser → Rust delegate → LLVM EXE 完動 ### 3. ドキュメント追加 - `docs/development/analysis/` - delegate 分析 - `docs/development/guides/` - ループテストガイド - `docs/development/testing/` - Stage-B 検証報告 ### 4. カナリーテスト追加 - `tools/smokes/v2/profiles/quick/core/phase2100/` 配下に複数追加 - emit_boxcall_length_canary_vm.sh - stageb_parser_loop_json_canary_vm.sh - 他 ### 受け入れ基準 - ✅ delegate パス: rc=10 返す - ✅ FORCE パス: rc=10 返す(既存) - ✅ MIR 構造: 正しい PHI incoming と compare - ✅ 既定挙動: 不変(dev トグルのみ) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
README.md
19
README.md
@ -32,14 +32,17 @@ Architecture notes
|
||||
|
||||
Execution Status (Feature Additions Pause)
|
||||
- Active
|
||||
- `--backend llvm` (Python/llvmlite harness; AOT object emit)
|
||||
- `--backend vm` (PyVM harness)
|
||||
- `--backend llvm` (ny-llvmc crate backend; llvmlite harness is internal) — AOT object/EXE line
|
||||
- `--backend vm` (VM / reference semantics)
|
||||
- Inactive/Sealed
|
||||
- `--backend cranelift`, `--jit-direct` (sealed; use LLVM harness)
|
||||
- AST interpreter (legacy) is gated by feature `interpreter-legacy` and excluded from default builds (Rust VM + LLVM are the two main lines)
|
||||
|
||||
Quick pointers
|
||||
- Emit object with harness: set `NYASH_LLVM_USE_HARNESS=1` and `NYASH_LLVM_OBJ_OUT=<path>` (defaults in tools use `tmp/`).
|
||||
- Emit object/EXE with crate backend:
|
||||
- `tools/ny_mir_builder.sh --in /path/mir.json --emit obj -o a.o`
|
||||
- `tools/ny_mir_builder.sh --in /path/mir.json --emit exe -o a.out`
|
||||
- auto-selects `ny-llvmc` when present(`NYASH_LLVM_BACKEND=crate` 明示でも可)
|
||||
- Run PyVM: `NYASH_VM_USE_PY=1 $NYASH_BIN --backend vm apps/APP/main.hako`.
|
||||
|
||||
Program(JSON v0) → MIR(JSON)
|
||||
@ -65,6 +68,7 @@ Phase‑15 (2025‑09) update
|
||||
- 推奨トグル: `NYASH_LLVM_USE_HARNESS=1`, `NYASH_PARSER_TOKEN_CURSOR=1`, `NYASH_JSON_PROVIDER=ny`, `NYASH_SELFHOST_EXEC=1`。
|
||||
|
||||
Developer quickstart: see `docs/guides/getting-started.md`. Changelog highlights: `CHANGELOG.md`.
|
||||
ny‑llvm line quickstart: `docs/development/testing/selfhost_exe_stageb_quick_guide.md`(Stage‑B → MirBuilder → ny‑llvmc → EXE)
|
||||
User Macros (Phase 2): `docs/guides/user-macros.md`
|
||||
Exceptions (postfix catch/cleanup): `docs/guides/exception-handling.md`
|
||||
ScopeBox & MIR hints: `docs/guides/scopebox.md`
|
||||
@ -261,12 +265,12 @@ cargo build --release --features cranelift-jit
|
||||
- Maximum performance
|
||||
- Easy distribution
|
||||
|
||||
### 4. **Native Binary (LLVM AOT, llvmlite harness)**
|
||||
### 4. **Native Binary (LLVM AOT, ny-llvmc crate backend)**
|
||||
```bash
|
||||
# Build harness + CLI (no LLVM_SYS_180_PREFIX needed)
|
||||
cargo build --release -p nyash-llvm-compiler && cargo build --release --features llvm
|
||||
|
||||
# Emit and run native executable via harness
|
||||
# Emit and run native executable via crate backend (ny-llvmc)
|
||||
NYASH_LLVM_USE_HARNESS=1 \
|
||||
NYASH_NY_LLVM_COMPILER=target/release/ny-llvmc \
|
||||
NYASH_EMIT_EXE_NYRT=target/release \
|
||||
@ -298,7 +302,7 @@ tools/smoke_aot_vs_vm.sh examples/aot_min_string_len.hako
|
||||
The WASM/browser path is currently not maintained and is not part of CI. The older playground and guides are kept for historical reference only.
|
||||
|
||||
- Source (archived): `projects/nyash-wasm/` (build not guaranteed)
|
||||
- Current focus: VM (Rust) and LLVM (llvmlite harness)
|
||||
- Current focus: VM (Rust) and LLVM (ny-llvmc crate backend; llvmlite harness is internal)
|
||||
- If you experiment locally, see the project README and `projects/nyash-wasm/build.sh` (wasm-pack required). No support guarantees.
|
||||
|
||||
---
|
||||
@ -323,7 +327,8 @@ Key options (minimal)
|
||||
- `--target <triple>` (only when needed)
|
||||
|
||||
Notes
|
||||
- LLVM AOT uses Python llvmlite harness. Ensure Python3 + llvmlite and `ny-llvmc` are available (built via `cargo build -p nyash-llvm-compiler`). No `LLVM_SYS_180_PREFIX` required.
|
||||
- LLVM AOT main line is the ny-llvmc crate backend. ny-llvmc internally delegates object emission to the Python llvmlite harness; end users should invoke ny-llvmc (or tools/ny_mir_builder.sh) rather than calling the harness directly.
|
||||
- Ensure `ny-llvmc` is built (`cargo build -p nyash-llvm-compiler`) and Python3 is available for the internal harness. No `LLVM_SYS_180_PREFIX` required.
|
||||
- Apps that open a GUI may show a window during AOT emission; close it to continue.
|
||||
- On WSL if the window doesn’t show, see `docs/guides/cranelift_aot_egui_hello.md` (Wayland→X11).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user