docs(current_task): add self-host dep-tree plan; tasks: add dep_tree; Makefile: add dep-tree target

This commit is contained in:
Selfhosting Dev
2025-09-08 01:42:50 +09:00
parent 1aad0479e7
commit f8beebc456
4 changed files with 42 additions and 1 deletions

View File

@ -867,3 +867,36 @@ Phase A 進捗(実施済)
- 現状: Interpreter 経路のプラグイン初期化順序により FileBox/TOMLBox を使うには Runner 側の微調整が必要VM 経路への移行 or プラグイン登録の早期化)。スクリプト本体は追加済み。 - 現状: Interpreter 経路のプラグイン初期化順序により FileBox/TOMLBox を使うには Runner 側の微調整が必要VM 経路への移行 or プラグイン登録の早期化)。スクリプト本体は追加済み。
- 直結ブリッジ v0R3 Quick Start - 直結ブリッジ v0R3 Quick Start
- `printf 'return (1+2)*3\n' > t.ny && NYASH_USE_NY_PARSER=1 NYASH_DUMP_JSON_IR=1 ./target/release/nyash t.ny` - `printf 'return (1+2)*3\n' > t.ny && NYASH_USE_NY_PARSER=1 NYASH_DUMP_JSON_IR=1 ./target/release/nyash t.ny`
---
New Plan — SelfHost Dependency Tree (Nyonly) and Bridge20250907
目的
- Ny スクリプトのみで依存木include + using/moduleを再帰解析して JSON を出力。Rust ビルド無しで回せる内側ループを整備。
- 既存の MIR→VM→AOT 系とは疎結合を維持しつつ、最小の橋渡しJSONファイル経由を用意。
実装項目(最小)
- ツール: `apps/selfhost/tools/dep_tree_simple.nyash`
- 1ファイル・静的boxで実装。1行1文break無しelseは同一行。
- 解析: `include "..."`、`using ns``using ns as Alias`、`using "./path" as Name`、`// @module ns=path`。
- 解決順: `module > 相対 > using-path`using-path 既定: `apps/selfhost:apps:lib:.`)。
- JSON: `{ version, root_path, tree{ path, includes[], uses[], modules[], children[] } }`uses は unresolved/hint/alias/resolved を含む)。
- タスク/Make:
- `nyash.toml [tasks].dep_tree` を追加し、1コマンドで JSON を `tmp/deps.json` に出力。
- `make dep-tree`: `cargo build --release && ./target/release/nyash --run-task dep_tree`。
- 受け入れ基準:
- `make dep-tree` が `tmp/deps.json` を出力。曖昧複数ヒットは注記STRICT で停止。
- VM/Interpreter いずれでも実行可File/Path/Array/Map 最小APIで実装
橋渡しStage 1: 疎結合)
- `NYASH_DEPS_JSON=<path>` を Runner で読取りログ出力等の診断用途。MIR/JIT/AOT の挙動は不変。
- 後続Stage 2以降は JSON IR `extensions.deps` や lock ファイルの導入を検討(別期)。
進め方(短期)
1) `dep_tree_simple.nyash` の完走化VM実行での File/Path 最小APIのみ使用
2) `nyash.toml` へ `dep_tree` 追加+ `make dep-tree` 整備。
3) Runner へ `NYASH_DEPS_JSON` の最小読込み(ログ出力)を追加(影響ゼロの範囲)。

View File

@ -1,6 +1,6 @@
# Nyash selfhosting-dev quick targets # Nyash selfhosting-dev quick targets
.PHONY: build build-release run-minimal smoke-core smoke-selfhost bootstrap roundtrip clean quick fmt lint .PHONY: build build-release run-minimal smoke-core smoke-selfhost bootstrap roundtrip clean quick fmt lint dep-tree
build: build:
cargo build --features cranelift-jit cargo build --features cranelift-jit
@ -41,3 +41,8 @@ dev:
dev-watch: dev-watch:
./tools/dev_selfhost_loop.sh --watch --std -v -- --using-path apps/selfhost:apps apps/selfhost-minimal/main.nyash ./tools/dev_selfhost_loop.sh --watch --std -v -- --using-path apps/selfhost:apps apps/selfhost-minimal/main.nyash
# --- Self-host dependency tree (Ny-only) ---
dep-tree:
cargo build --release
./target/release/nyash --run-task dep_tree

BIN
app Normal file

Binary file not shown.

View File

@ -410,6 +410,9 @@ ny_plugins = [
] ]
[tasks] [tasks]
# self-host: dependency tree (Ny-only)
dep_tree = "NYASH_USE_PLUGIN_BUILTINS=1 NYASH_DISABLE_PLUGINS=0 {root}/target/release/nyash --backend vm {root}/apps/selfhost/tools/dep_tree_simple.nyash -- {root}/apps/selfhost/ny-parser-nyash/main.nyash > {root}/tmp/deps.json"
# LLVMビルドnyash本体 # LLVMビルドnyash本体
build_llvm = "LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) cargo build --release --features llvm" build_llvm = "LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) cargo build --release --features llvm"