docs(current_task): add self-host dep-tree plan; tasks: add dep_tree; Makefile: add dep-tree target
This commit is contained in:
@ -867,3 +867,36 @@ Phase A 進捗(実施済)
|
|||||||
- 現状: Interpreter 経路のプラグイン初期化順序により FileBox/TOMLBox を使うには Runner 側の微調整が必要(VM 経路への移行 or プラグイン登録の早期化)。スクリプト本体は追加済み。
|
- 現状: Interpreter 経路のプラグイン初期化順序により FileBox/TOMLBox を使うには Runner 側の微調整が必要(VM 経路への移行 or プラグイン登録の早期化)。スクリプト本体は追加済み。
|
||||||
- 直結ブリッジ v0(R3 Quick Start)
|
- 直結ブリッジ v0(R3 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 — Self‑Host Dependency Tree (Ny‑only) and Bridge(2025‑09‑07)
|
||||||
|
|
||||||
|
目的
|
||||||
|
- 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` の最小読込み(ログ出力)を追加(影響ゼロの範囲)。
|
||||||
|
|||||||
7
Makefile
7
Makefile
@ -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
|
||||||
|
|||||||
@ -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"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user