restore(lang): full lang tree from ff3ef452 (306 files) — compiler, vm, shared, runner, c-abi, etc.\n\n- Restores lang/ directory (files≈306, dirs≈64) as per historical branch with selfhost sources\n- Keeps our recent parser index changes in compiler/* (merged clean by checkout)\n- Unblocks selfhost development and documentation references

This commit is contained in:
nyash-codex
2025-10-31 20:45:46 +09:00
parent dbc285f2b1
commit e5f697eb22
244 changed files with 16915 additions and 47 deletions

View File

@ -0,0 +1,13 @@
# Runner Core (Plan Builder)
Scope
- Decision-only layer to build a `RunnerPlan` from CLI/ENV inputs.
- No I/O or process execution here. Rust (Floor) applies the plan.
Status
- Phase 20.26C scaffold. Optin via `HAKO_RUNNER_PLAN=1` once wired.
Contract (MVP)
- Provide `RunnerPlanBuilder.build(args)` that returns a small JSON object with a minimal set of fields:
- `{"action":"ExecuteCore|ExecuteVM|ExecuteNyLlvmc|Skip|Error", "gate_c":bool, "engine":"core|vm|llvm", "plugins":bool, "quiet":bool}`
- FailFast on ambiguity; no silent fallbacks.

View File

@ -0,0 +1,34 @@
// RunnerPlanBuilder (JSON Plan) — Phase 20.26C
// Responsibility: Build a minimal RunnerPlan JSON from a tiny JSON payload.
// Contract: build/1 accepts a JSON-like string and returns a JSON object string:
// {"action":"ExecuteCore|ExecuteVM|ExecuteNyLlvmc|Skip|Error","gate_c":bool,
// "engine":"core|vm|llvm", "plugins":bool, "quiet":bool }
static box RunnerPlanBuilder {
build(j) {
// MVP: naive scan (no JSON parser dependency).
// Priority: explicit backend → ExecuteVM/ExecuteNyLlvmc;
// boxes directive → ExecuteBoxes;
// else if gate_c → ExecuteCore; else Skip.
local gate = j.indexOf("\"gate_c\":true") >= 0
local act = "Skip"
if (j.indexOf("\"backend\":\"vm\"") >= 0) { act = "ExecuteVM" }
else if (j.indexOf("\"backend\":\"llvm\"") >= 0) { act = "ExecuteNyLlvmc" }
// boxes toggle (optional). If present and no stronger action decided, produce ExecuteBoxes
local boxes_val = ""
if (j.indexOf("\"boxes\":\"hako\"") >= 0) { boxes_val = "hako" }
else if (j.indexOf("\"boxes\":\"rust\"") >= 0) { boxes_val = "rust" }
if (act == "Skip" && boxes_val != "") { act = "ExecuteBoxes" }
else if (act == "Skip" && gate) { act = "ExecuteCore" }
// Compose a compact JSON string (keys kept minimal and stable)
local plan = "{\"action\":\"" + act + "\"," +
"\"gate_c\":" + (gate ? "true" : "false") + "," +
"\"engine\":\"core\"," +
"\"plugins\":false," +
"\"quiet\":true" +
(boxes_val != "" ? ",\"boxes\":\"" + boxes_val + "\"" : "") +
"}"
return plan
}
}