hv1 verify: add direct route (env JSON) and clean inline path; fix v1 phi incoming order; make test_runner use hv1 direct; add phase2037 phi canaries; load modules.workspace exports for alias; update docs (phase-20.38, source extensions) and CURRENT_TASK
This commit is contained in:
36
docs/guides/c-abi-bridge-v0.md
Normal file
36
docs/guides/c-abi-bridge-v0.md
Normal file
@ -0,0 +1,36 @@
|
||||
# C‑ABI Bridge v0 (Phase 20.38)
|
||||
|
||||
Purpose
|
||||
- Provide a minimal, guarded bridge from Hakorune VM to Rust extern providers without changing behavior.
|
||||
- Keep default OFF; use tags for observability, return empty string to keep rc=0.
|
||||
|
||||
Scope (v0)
|
||||
- Supported names (Extern):
|
||||
- `env.mirbuilder.emit` — program_json → mir_json
|
||||
- `env.codegen.emit_object` — mir_json → object path
|
||||
- Call shapes:
|
||||
- Hako provider: `HakoruneExternProviderBox.get(name, arg)`
|
||||
- Legacy global: `hostbridge.extern_invoke(name, method, [arg])`
|
||||
|
||||
Behavior
|
||||
- When `HAKO_V1_EXTERN_PROVIDER=1` (provider ON):
|
||||
- Hako provider returns empty string (`""`), rc remains 0.
|
||||
- When `HAKO_V1_EXTERN_PROVIDER_C_ABI=1` (C‑ABI tag ON):
|
||||
- Provider prints tags to stderr: `[extern/c-abi:mirbuilder.emit]`, `[extern/c-abi:codegen.emit_object]`.
|
||||
- Return remains empty string (rc=0)。
|
||||
|
||||
Toggles
|
||||
- `HAKO_V1_EXTERN_PROVIDER=1` — enable provider path (default OFF).
|
||||
- `HAKO_V1_EXTERN_PROVIDER_C_ABI=1` — emit C‑ABI tags (default OFF).
|
||||
|
||||
Verify
|
||||
- Use Hakorune primary path (`HAKO_VERIFY_PRIMARY=hakovm`)
|
||||
- Pass JSON via env: `NYASH_VERIFY_JSON`
|
||||
- rc extraction: last numeric line
|
||||
|
||||
Rollback/Disable
|
||||
- Unset `HAKO_V1_EXTERN_PROVIDER` (and `HAKO_V1_EXTERN_PROVIDER_C_ABI`) to restore pure stub behavior.
|
||||
|
||||
Notes
|
||||
- v0 is intentionally minimal and behavior‑preserving. v1 may return real values and propagate errors under flags.
|
||||
|
||||
36
docs/guides/source-extensions.md
Normal file
36
docs/guides/source-extensions.md
Normal file
@ -0,0 +1,36 @@
|
||||
Source Extensions Policy — .nyash vs .hako (Interim)
|
||||
|
||||
Intent
|
||||
- Keep development stable while Hakorune VM (v1 Dispatcher/IR/φ) is brought up.
|
||||
- Avoid cross‑contamination between frontends; converge at MIR.
|
||||
|
||||
Execution Mapping (current)
|
||||
- .nyash → Nyash VM (Rust): NyashParser → MIR → VM. Full runtime/plugins path.
|
||||
- .hako → Hakorune VM (v1): JSON v1 Dispatcher/IR/φ(bring‑up coverage; guarded extern).
|
||||
- verify (MIR v1) → Hakorune primary, Core fallback for diagnosis.
|
||||
|
||||
Resolver/Include/Normalize
|
||||
- Using: unify to text‑merge (merge_prelude_text). AST prelude merge is retired.
|
||||
- Include: language‑level unsupported; quick profile treats include as ERROR. Preinclude is test‑harness only(verify の include fallback は撤去済み)。
|
||||
- Normalize (inline/dev): CRLF→LF, redundant `; }` trimmed, tolerant `local` at line head in Hakorune inline drivers.
|
||||
|
||||
Fail‑Fast Guards
|
||||
- Hako in Nyash VM: rejected by default (Fail‑Fast). Toggle: `HAKO_FAIL_FAST_ON_HAKO_IN_NYASH_VM=0` for dev only.
|
||||
- Extern (Hako provider): `HAKO_V1_EXTERN_PROVIDER=1`; optional C‑ABI tag/bridge with `HAKO_V1_EXTERN_PROVIDER_C_ABI=1` (default OFF).
|
||||
|
||||
Why two extensions now?
|
||||
- Same language intent, but different stability constraints at the frontend boundary:
|
||||
- .hako through NyashParser caused parse/timeout/alias issues historically.
|
||||
- We intentionally stopped that path and direct .hako to Hakorune VM while it matures.
|
||||
|
||||
Migration Plan (phased)
|
||||
1) P2: IR iteration complete; φ table robust; dispatcher loop scan‑free; extern canaries PASS without harness shim.
|
||||
2) P3: verify default → Hakorune (Core fallback); document toggles and remove ad‑hoc heuristics.
|
||||
3) Prep: introduce stable Nyash→MIR v1 emit route to feed Hakorune VM when (and if) we want .nyash on hv1.
|
||||
4) Deprecation: warn on `.nyash` (opt‑in), then Fail‑Fast once hv1 parity is sufficient; remove legacy code in a later phase.
|
||||
|
||||
Best Practices (now)
|
||||
- Prefer alias/modules over path using; avoid include in source.
|
||||
- Keep quotes ASCII (`"`); avoid trailing semicolons before `}`.
|
||||
- For verify, pass JSON via env (`NYASH_VERIFY_JSON`) and parse last numeric line as rc.
|
||||
- Inline(-c)ドライバは alias のみで構成(include 不要)。
|
||||
@ -22,6 +22,11 @@ using / include
|
||||
- Prefer `as` aliases for readability. Aliases should be `PascalCase`.
|
||||
- Keep `include` adjacent to `using` group, sorted and one per line.
|
||||
|
||||
String concatenation policy
|
||||
- Avoid using `"" + id` (implicit to-string) when building map/register keys or control values.
|
||||
- Use explicit conversion helpers instead, e.g. `StringHelpers.int_to_str(id)`.
|
||||
- Plain string building for messages or JSON emit is allowed to use `+` for clarity (no key/control impact).
|
||||
|
||||
Naming (conventions for Nyash code)
|
||||
- Boxes (types): `PascalCase` (e.g., `ConsoleBox`, `PathBox`).
|
||||
- Methods/functions: `lowerCamelCase` (e.g., `length`, `substring`, `lastIndexOf`).
|
||||
|
||||
Reference in New Issue
Block a user