Commit Graph

923 Commits

Author SHA1 Message Date
ae84391a95 bridge: inject static box singleton for LLVM instruction ModuleFunction calls 2025-11-01 07:13:48 +09:00
a87ea2636c docs: clarify static box method arity (implicit self) and plan fix in Phase 20.33; expand Bridge singleton injection spec; update checklist 2025-11-01 07:07:29 +09:00
eabeb69d77 docs(phase-20.33): update Gate-C(Core) status (v1→MIR interpreter), mark parity smokes done; clean up wording\nchore: remove unused bak/ (external backup kept)\nsmokes: add Gate-C v1 file/pipe opt-in canaries; env toggles documented\nrunner: include json_v1_bridge + bridge toggles (singleton/phi) wiring 2025-11-01 07:02:04 +09:00
cac22c1a87 Runner: canonicalize json-file input via core_bridge when HAKO_NYVM_CORE=1 2025-11-01 05:19:10 +09:00
4f4ee948e0 Stage-B: add --v1-compat opt-in path and smoke 2025-11-01 03:56:25 +09:00
1f415e733c Stage-B: route FlowEntry context (using/extern) and default Stage-B entry 2025-11-01 03:03:51 +09:00
c868667e26 Merge feature: NyVM wrapper bridge scaffold + Stage‑B canaries (opt‑in); keep Gate‑C as default 2025-11-01 02:52:10 +09:00
978bb4a5c6 runner: add NyVM wrapper core_bridge (canonicalize/dump) + opt-in wrapper canary; export module in common_util 2025-11-01 02:51:49 +09:00
5597b78f0d docs(phase-20.33): Stage‑B Hakorune compiler plan (scope/milestones/criteria) 2025-11-01 01:49:42 +09:00
8b71f25dd4 Stage-A selfhost emitter fixes and LLVM opt toggle 2025-10-31 23:16:27 +09:00
abe174830f hako(compiler): Fix binary operators and if statements parsing
- Implement simplified binary operator parsing (+, -, *, /) with proper JSON output
- Add comparison operator parsing (==, >) for if statements
- Fix if statement parsing with proper body extraction and print statement handling
- Resolve missing parenthesis issue in if body parsing
- All smoke tests now PASS: hako_min_binop_vm.sh and hako_min_if_vm.sh
- Maintain existing functionality: array read/write, map rw canaries still green

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-31 23:00:06 +09:00
5208491e6e hako( compiler): Stage-A enhancements - map literals, binary/compare operators, if statements, and error diagnostics
- Implement map literal parsing with basic key/value pairs: {a:1,b:2}
- Add binary operators (+, -, *, /) with precedence handling
- Add comparison operators (>, <, ==, !=, >=, <=) for if statements
- Implement minimal if statement parsing: if(condition){statement}
- Add string indexing error diagnostic for unsupported Stage-A features
- Create new smoke tests: hako_min_binop_vm.sh and hako_min_if_vm.sh
- Enhance JSON v0 output with proper ExprV0.Binary and ExprV0.Compare structures

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-31 22:48:46 +09:00
e5f697eb22 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 2025-10-31 20:45:46 +09:00
dbc285f2b1 hako(parser): add index operator support
- ParserExprBox: support postfix [expr] and lower to Method(recv, "get", [index])
- ParserStmtBox: support index assignment IDENT [expr] = expr → Expr(Method(recv, "set", [idx, val]))
- Note: lowering uses existing Method → MIR emit path (int args). Phase‑1 canaries use int indices/values.
2025-10-31 20:22:43 +09:00
5e3d9e7ae4 restore(lang/compiler): bring back lang/src/compiler from e917d400; add Hako index canaries and docs; implement Rust-side index operator (Array/Map get/set) with Fail‑Fast diagnostics
- restore: lang/src/compiler/** (parser/emit/builder/pipeline_v2) from e917d400
- docs: docs/development/selfhosting/index-operator-hako.md
- smokes(hako): tools/smokes/v2/profiles/quick/core/index_operator_hako.sh (opt-in)
- smokes(vm): adjust index_operator_vm.sh for semicolon gate + stable error text
- rust/parser: allow IndexExpr and assignment LHS=Index; postfix parse LBRACK chain
- rust/builder: lower arr/map index to BoxCall get/set; annotate array/map literals; Fail‑Fast for unsupported types
- CURRENT_TASK: mark Rust side done; add Hako tasks checklist

Note: files disappeared likely due to branch FF to a lineage without lang/src/compiler; no explicit delete commit found. Added anchor checks and suggested CI guard in follow-up.
2025-10-31 20:18:39 +09:00
86fd03afe8 docs(specs): add Index Operator design; CURRENT_TASK: plan for Phase‑20.31 small-scope bring‑up 2025-10-31 19:35:47 +09:00
8cc4654a7f naming: add hako/hakorune wrappers; hako-check prefers alias via HAKO_BIN or tools/bin/hako; docs updated 2025-10-31 19:22:00 +09:00
8596bea1ee tools(hako-check): add lightweight script checker (parse→MIR verify) + README; uses nyash --backend mir --verify 2025-10-31 19:16:05 +09:00
712b370013 aot(core): EXE path green (return 7); migrate NyRT jit handles → runtime::host_handles; fix mir_call.py indent; workspace excludes for missing plugins; docs(phase-33) status update 2025-10-31 18:30:50 +09:00
c11803797a docs(phase-33): status update — AOT EXE 'return 7' blockers and next steps; keep main clean, continue on phase33 branch 2025-10-31 18:05:39 +09:00
8fd3a2b509 docs: restore docs/private/roadmap from 7b4908f9 (Phase 20.31) 2025-10-31 18:00:10 +09:00
1d49e24bf0 selfhost-compiler: make EmitterBox/MirEmitterBox static; call as Class.method to avoid NewBox→birth warnings and stabilize JSON emission path 2025-09-28 20:56:12 +09:00
59eb39e8a0 docs: mark WASM/browser as paused/unmaintained; update README (en/ja), wasm guides banner; archive note in projects/nyash-wasm README 2025-09-28 20:47:45 +09:00
4736d2ceb5 selfhost-compiler: remove duplicate using; use unqualified Box names (ParserBox/EmitterBox/etc.) to match grammar; add dev selfhost smoke 2025-09-28 20:40:06 +09:00
dd65cf7e4c builder+vm: unify method calls via emit_unified_call; add RouterPolicy trace; finalize LocalSSA/BlockSchedule guards; docs + selfhost quickstart
- Unify standard method calls to emit_unified_call; route via RouterPolicy and apply rewrite::{special,known} at a single entry.\n- Stabilize emit-time invariants: LocalSSA finalize + BlockSchedule PHI→Copy→Call ordering; metadata propagation on copies.\n- Known rewrite default ON (userbox only, strict guards) with opt-out flag NYASH_REWRITE_KNOWN_DEFAULT=0.\n- Expand TypeAnnotation whitelist (is_digit_char/is_hex_digit_char/is_alpha_char/Map.has).\n- Docs: unified-method-resolution design note; Quick Reference normalization note; selfhosting/quickstart.\n- Tools: add tools/selfhost_smoke.sh (dev-only).\n- Keep behavior unchanged for Unknown/core/user-instance via BoxCall fallback; all tests green (quick/integration).
2025-09-28 20:38:09 +09:00
e442e5f612 builder: copy renamed pin slots across blocks and update user vars to new ids at block entry (fix recv undefined across loop headers) 2025-09-28 12:38:15 +09:00
a472938916 builder: pin receiver in emit_box_or_plugin_call to prevent undefined recv across blocks (Patch‑A) 2025-09-28 12:32:26 +09:00
510f4cf523 builder/vm: stabilize json_lint_vm under unified calls
- Fix condition_fn resolution: Value call path + dev safety + stub injection
- VM bridge: handle Method::birth via BoxCall; ArrayBox push/get/length/set direct bridge
- Receiver safety: pin receiver in method_call_handlers to avoid undefined use across blocks
- Local vars: materialize on declaration (use init ValueId; void for uninit)
- Prefer legacy BoxCall for Array/Map/String/user boxes in emit_box_or_plugin_call (stability-first)
- Test runner: update LLVM hint to llvmlite harness (remove LLVM_SYS_180_PREFIX guidance)
- Docs/roadmap: update CURRENT_TASK with unified default-ON + guards

Note: NYASH_DEV_BIRTH_INJECT_BUILTINS=1 can re-enable builtin birth() injection during migration.
2025-09-28 12:19:49 +09:00
41a46b433d smokes: add LLVM build hint on skip; README: how to run AST/LLVM tests in quick by enabling LLVM first 2025-09-28 02:13:53 +09:00
fe0578a2fb llvm-harness: add optional NYASH_LLVM_TRACE_CALLS to print mir_call callee (includes Method.certainty) for diagnostics; no behavior change 2025-09-28 02:11:12 +09:00
3768063b1e vm/router: add DebugHub events for class-reroute and special-reroute (toString->stringify, equals fallback); zero-cost when disabled 2025-09-28 02:08:26 +09:00
c409aa6ad1 runner: promote @local expansion to first-class (default ON) across vm & selfhost; docs updated to reflect standard sugar 2025-09-28 02:05:41 +09:00
1994990f47 docs: confirm Option A (no var/let; explicit local). Add notes to cheatsheet, language reference, tutorials. CURRENT_TASK updated with decision and next small items. 2025-09-28 02:00:53 +09:00
a4d014a814 debug: add NYASH_DEBUG_SAMPLE_EVERY to sample DebugHub events (dev-only, zero-cost when unset) 2025-09-28 01:39:12 +09:00
34be7d2d79 vm/router: minimal special-method extension (equals/1); toString mapping kept
mir: add TypeCertainty to Callee::Method (diagnostic only); plumb through builder/JSON/printer; backends ignore behaviorally

using: confirm unified prelude resolver entry for all runner modes

docs: update Callee architecture with certainty; update call-instructions; CURRENT_TASK note

tests: quick 40/40 PASS; integration (LLVM) 17/17 PASS
2025-09-28 01:33:58 +09:00
8ea95c9d76 docs: add instance-dispatch & birth invariants; smokes probe policy; archive CURRENT_TASK and replace with concise plan; impl VM stringify(Void) safety; tighten heavy probes; enable rewrite default ON 2025-09-27 08:56:43 +09:00
cb236b7f5a json(vm): fix birth dispatch; unify constructor naming (Box.birth/N); JsonNode factories return JsonNodeInstance; quick: enable heavy JSON with probe; builder: NYASH_BUILDER_DEBUG_LIMIT guard; json_query_min(core) harness; docs/tasks updated 2025-09-27 08:45:25 +09:00
fcf8042b06 builder: propagate value_types and value_origin_newbox in pin_to_slot (stabilize rewrite/type inference across pin/PHI) 2025-09-26 14:47:52 +09:00
cdf826cbe7 public: publish selfhost snapshot to public repo (SSOT using + AST merge + JSON VM fixes)
- SSOT using profiles (aliases/packages via nyash.toml), AST prelude merge
- Parser/member guards; Builder pin/PHI and instance→function rewrite (dev on)
- VM refactors (handlers split) and JSON roundtrip/nested stabilization
- CURRENT_TASK.md updated with scope and acceptance criteria

Notes: dev-only guards remain togglable via env; no default behavior changes for prod.
2025-09-26 14:34:42 +09:00
ecd46161b3 tasks: update CURRENT_TASK with containment plan; add minimal VM drivers for JSON roundtrip/null and scanner is_eof tracing 2025-09-26 14:17:16 +09:00
cf4b615afb mir/vm: SSA pin+PHI + short-circuit; user-defined method calls → functions; entry single-pred PHIs; compare-operand pin; VM BoxCall fallback to InstanceBox methods; docs: update CURRENT_TASK (plan + acceptance)
- Lower And/Or to branch+PHI (RHS not evaluated)
- Always slotify compare operands (dominance safety)
- Insert single-predecessor PHIs at then/else/short-circuit entries
- pin_to_slot now logs (NYASH_PIN_TRACE) and participates in PHI
- Rewrite user-defined instance method calls to Box.method/Arity (builder)
- VM fallback: BoxCall on InstanceBox dispatches to lowered functions with 'me'+args
- Keep plugin/BoxCall path for core boxes (String/Array/Map)
- Add env-gated pre-pin for if/loop (NYASH_MIR_PREPIN)
- CURRENT_TASK: add SSA/userbox plan, debug steps, acceptance criteria
2025-09-26 05:28:20 +09:00
6e1bf149fc builder: pre-pin comparison operands in if_form and loop_builder (lower_if_in_loop/build_loop) to slots; utils: pin_to_slot pub(crate) and entry materialize for pinned slots only; continue JSON VM debug 2025-09-26 04:17:56 +09:00
fd56b8049a mir: implement proper short-circuit lowering (&&/||) via branch+phi; vm: add NYASH_VM_TRACE exec/phi logs and reg_load diagnostics; vm-fallback: minimal Void guards (push/get_position/line/column), MapBox.birth no-op; smokes: filter builtin Array/Map plugin notices; docs: CURRENT_TASK updated 2025-09-26 03:30:59 +09:00
041cef875a json-native: token positions (line/column); escape utils BMP coverage + surrogate guard; add smokes for string escapes, nested, and error cases (AST/VM) 2025-09-26 00:42:55 +09:00
b3a96faccb smokes: add JSON nested/invalid cases; force VM backend; temp nyash.toml with json_native package for resolution 2025-09-26 00:38:14 +09:00
6ce06501e1 json-native: enable float roundtrip in parser (NUMBER => float by '.'/exp); expand roundtrip smoke with more numeric cases 2025-09-26 00:32:20 +09:00
4503643af4 smokes: add JSON roundtrip AST quick test; parser guard fully removed; legacy using inlining removed (AST-only path) 2025-09-26 00:28:56 +09:00
85084664c2 docs+runner+parser: SSOT+AST using finalized (legacy text inlining removed); provider verify reads nyash.toml; preflight warn hook; method-body guard removed; CURRENT_TASK updated for next JSON work 2025-09-26 00:27:02 +09:00
d9f26d4549 feat: nyash.toml SSOT + using AST統合完了(12時間の戦い)
- nyash.tomlを唯一の真実(SSOT)として依存管理確立
- dev/ci/prodプロファイルによる段階的厳格化実装
- AST結合で宣言/式の曖昧性を根本解決
- Fail-Fast原則をCLAUDE.md/AGENTS.mdに明文化
- VM fallbackでもASTベース using有効化(NYASH_USING_AST=1)
- 静的メソッドの is_static=true 修正で解決安定化
- STATICブレークハック既定OFF化で堅牢性向上

🎉 usingシステム完全体への道筋確立!JSONライブラリ・Nyash VM開発が可能に

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 16:03:29 +09:00
2f5723b56d parser(static): treat ident '(' ... ')' '{' as method in static box with newline tolerance; forbid member expr fallback; using(ast) groundwork retained. Run AST mode via NYASH_USING_AST=1. 2025-09-25 10:45:34 +09:00