trace: add execution route visibility + debug passthrough; phase2170 canaries; docs

- Add HAKO_TRACE_EXECUTION to trace executor route
  - Rust hv1_inline: stderr [trace] executor: hv1_inline (rust)
  - Hakovm dispatcher: stdout [trace] executor: hakovm (hako)
  - test_runner: trace lines for hv1_inline/core/hakovm routes
- Add HAKO_VERIFY_SHOW_LOGS and HAKO_DEBUG=1 (enables both)
  - verify_v1_inline_file() log passthrough with numeric rc extraction
  - test_runner exports via HAKO_DEBUG
- Canary expansion under phase2170 (state spec)
  - Array: push×5/10 → size, len/length alias, per‑recv/global, flow across blocks
  - Map: set dup-key non-increment, value_state get/has
  - run_all.sh: unify, remove SKIPs; all PASS
- Docs
  - ENV_VARS.md: add Debug/Tracing toggles and examples
  - PLAN.md/CURRENT_TASK.md: mark 21.7 green, add Quickstart lines

All changes gated by env vars; default behavior unchanged.
This commit is contained in:
nyash-codex
2025-11-08 23:45:29 +09:00
parent bf185ec2b2
commit fa3091061d
49 changed files with 1334 additions and 110 deletions

View File

@ -1,5 +1,4 @@
// tools/hako_parser/parser_core.hako - HakoParserCoreBox (token-based MVP)
using selfhost.shared.common.string_helpers as Str
using tools.hako_parser.tokenizer as HakoTokenizerBox
static box HakoParserCoreBox {
@ -47,8 +46,13 @@ static box HakoParserCoreBox {
continue
}
if me._eq(t, "INCLUDE") == 1 {
// include "path"
p = me._advance(p, N); local s=me._peek(toks, p, N); if me._eq(s, "STRING") == 1 { ast.get("includes").push(Str.int_to_str(s.get("line"))); p = me._advance(p, N) }
// include "path" (record line for diagnostics as string to keep emitter simple)
p = me._advance(p, N)
local s = me._peek(toks, p, N)
if me._eq(s, "STRING") == 1 {
local ln = s.get("line"); if ln == null { ln = 0 }
ast.get("includes").push(me._itoa(ln)); p = me._advance(p, N)
}
continue
}
if me._eq(t, "STATIC") == 1 {
@ -115,6 +119,12 @@ static box HakoParserCoreBox {
_peek(toks, idx, N) { if idx >= N { return null } return toks.get(idx) }
_eq(t, kind) { if t == null { return 0 } if t.get("type") == kind { return 1 } return 0 }
_advance(p, N) { if p < N { return p + 1 } return p }
_itoa(n) {
local v = 0 + n; if v == 0 { return "0" }
local digits = "0123456789"; local out = ""; local tmp = ""
while v > 0 { local d = v % 10; tmp = digits.substring(d,d+1) + tmp; v = v / 10 }
out = tmp; return out
}
}
static box HakoParserCoreMain { method main(args) { return 0 } }