Commit Graph

725 Commits

Author SHA1 Message Date
1b12b1eb7d refactor(plugins): physically remove legacy v1 ABI/init across all first-party plugins; exclude/remove legacy test-multibox crate 2025-09-17 22:58:21 +09:00
b8e454963a chore(legacy): comment-out legacy v1 exports (nyash_plugin_invoke/abi/init) across first-party plugins; retain only TypeBox v2 path; remove legacy plugin loader and C-ABI nyash-file 2025-09-17 22:49:53 +09:00
b420929f53 chore(legacy): remove unused legacy plugin loader and C-ABI nyash-file plugin; unify plugin headers to TypeBox v2 2025-09-17 22:32:38 +09:00
d93595ab83 docs(plugins): update headers to TypeBox v2; expand v2 doc with Regex/Net method tables; remove BID mentions where v2 exists 2025-09-17 22:30:19 +09:00
b6ad86f087 ci(llvm): add ny-llvmc object generation workflow (crate path) using hello_simple_llvm sample 2025-09-17 22:25:44 +09:00
d992fa1d2d feat(llvm): wire nyash --emit-mir-json into build_llvm.sh crate path; add NYASH_LLVM_ONLY_OBJ gate; fix ny-llvmc bin name 2025-09-17 22:11:59 +09:00
8aa01668ff feat(plugins): migrate Python family to TypeBox v2; complete first‑party v2 set (Regex/Net/Path/Math/Time/File)\n\nfeat(smoke): add Net round‑trip sample and wire to plugin v2 smoke\n\nfeat(cli): add --emit-mir-json and runner emit+exit path\n\nchore(config): register Python v2 boxes in nyash.toml\n\nchore(loader): improve v2 diagnostics and ensure v2 shim dispatch\n\nchore(build): integrate ny-llvmc env gate in build_llvm.sh\n\nchore(tasks): update CURRENT_TASK with v2 Python/Net/emit flag 2025-09-17 22:01:29 +09:00
fcf8042622 docs(abi): align v2 with Phase‑12 blueprint; add roadmap/forward‑compat notes and Phase‑15 status pointer 2025-09-17 21:58:47 +09:00
913ca8b731 runtime(plugin): unify to Nyash ABI v2 dispatch via shim; loader drops legacy nyash_plugin_invoke and records TypeBox invoke_id; all PluginBoxV2 invoke paths use v2 shim 2025-09-17 20:42:01 +09:00
4ea3ca2685 docs/ci: selfhost bootstrap/exe-first workflows; add ny-llvmc scaffolding + JSON v0 schema validation; plan: unify to Nyash ABI v2 (no backwards compat) 2025-09-17 20:33:19 +09:00
a5054a271b llvm(py): introduce BuildCtx + trace hub; refactor if-merge prepass + PHI wiring into module; unify logs; ctx-enable compare/ret/call/boxcall/externcall/typeop/newbox/safepoint; curated smoke option for if-merge; README updates; keep behavior stable 2025-09-17 16:11:01 +09:00
2720884a20 bridge/json_v0: split expr lowering; add Ternary/Peek lowering + AST; selfhost Peek JSON emit; add selfhost Peek smoke; warning cleanup in lowering/optimizer/verification
- Split expr lowering into ; route calls from stmt lowering
- Implement ternary/peek lowering (MIR13 PHI-off=Copy, PHI-on=Phi)
- Extend JSON v0 AST (ExprV0::{Ternary,Peek}, PeekArmV0)
- Selfhost parser_box: emit Peek JSON; add Stage-2 'Peek basic' smoke
- Reduce warnings: remove unused imports/vars in several modules
- current_task: update plan for legacy VM/Interpreter offboarding
2025-09-17 11:45:57 +09:00
d99b941218 docs: add MIR13 mode doc and set PHI-off as default; bridge lowering split (if/loop/try); llvmlite resolver stabilization; curated runner default PHI-off; refresh CURRENT_TASK.md 2025-09-17 10:58:12 +09:00
31f90012e0 refactor: extract helpers (builder_calls: math/env/me; json_v0_bridge: new_block/merge_values) — non-functional cleanup; cargo check + smokes green 2025-09-17 08:20:44 +09:00
a3282abdd9 json_v0_bridge: add new_block() helper; refactor block creation in logical/try/loop; allow(dead_code) wrappers to quieten unused warnings (no behavior change) 2025-09-17 08:16:26 +09:00
dd53d38c8f builder: widen AST wrapper adoption (Binary/Call/Method/Field) and loop helper usage; non-functional refactor with cargo check passing 2025-09-17 08:11:47 +09:00
e2379b35b3 ast: add MethodCallExpr/FieldAccessExpr wrappers; builder: adopt wrappers for method/field, and add loop helpers (create_loop_blocks/add_predecessor). No behavior change. 2025-09-17 08:10:21 +09:00
6b505b5435 builder: add loop helpers (create_loop_blocks/add_predecessor) and adopt in LoopBuilder; use BinaryExpr/CallExpr wrappers in expr lowering (no behavior change) 2025-09-17 07:59:41 +09:00
f3be8ea5f6 builder/exprs: use AssignStmt and ReturnStmt wrappers for clearer destructuring (no behavior change) 2025-09-17 07:57:29 +09:00
3f930a0057 builder/stmts: use CallExpr wrapper in build_print_statement for isType/asType pattern (no behavior change) 2025-09-17 07:54:45 +09:00
ff3acd41ee ast: add wrapper structs (AssignStmt/ReturnStmt/IfStmt, BinaryExpr/CallExpr) with TryFrom/From for non-breaking gradual refactors 2025-09-17 07:53:05 +09:00
e47ee65a40 mir(builder/loops): add in_loop()/depth() helpers; clean up Break lowering comment (no behavior change) 2025-09-17 07:50:15 +09:00
ee4224d7d2 llvm_py: extract setup_phi_placeholders() and keep snapshots in lower_block (no behavior change) 2025-09-17 07:45:50 +09:00
adbb0201a9 chore(fmt): add legacy stubs and strip trailing whitespace to unblock cargo fmt 2025-09-17 07:43:07 +09:00
fcf8ce1f3c mir: split build_module phases 2025-09-17 07:29:28 +09:00
7aea9a934f ast: extract utility helpers 2025-09-17 07:27:55 +09:00
f80f6b7796 docs: update CURRENT_TASK.md with logging helpers and next steps (runner trace + selfhost helpers) 2025-09-17 07:12:15 +09:00
c704ac4338 runner: add trace::cli_v macro and apply in common.rs; use cli_verbose() in more callsites; tidy prints 2025-09-17 06:58:02 +09:00
c553f2952d runner/env: centralize CLI/env getters; parser expr split (call/primary); verifier utils direct; optimizer: boxfield peephole; LLVM: branch cond normalize hook; add trace macro scaffolding; refactor common.rs verbose checks 2025-09-17 06:55:39 +09:00
9dc5c9afb9 refactor: split optimizer/verifier/parser modules (mainline); add runner trace/directives; add LLVM terminator/select scaffolds; extract AST Span; update CURRENT_TASK with remaining plan 2025-09-17 05:56:33 +09:00
154778fc57 mir: extract CSE into passes::cse and wire it in optimizer. Behavior preserved (count-only, no SSA rewrites). Build + PyVM Stage-2 smokes PASS. 2025-09-17 03:41:04 +09:00
56463c75f6 mir: introduce passes::dce and minimal MirPass trait; rewire optimizer to use modular DCE pass. Build + PyVM Stage-2 smokes PASS. 2025-09-17 03:32:05 +09:00
b60d3a0305 runner/json_v0_bridge: split into module dir with ast.rs, lowering.rs, lexer.rs, mod.rs. Keep public API (parse_json_v0_to_module, parse_source_v0_to_module, maybe_dump_mir) unchanged; introduce BridgeEnv/VarScope in lowering; move tiny lexer/parser. Build + PyVM Stage-2 smokes PASS. 2025-09-17 03:03:11 +09:00
4bd49884ca llvm/codegen: extract wrapper/object emission into object.rs; dedupe mod.rs. runner/json_v0_bridge: introduce BridgeEnv + VarScope to unify lowering paths (lower_expr/args) and cache env flags; thread env through stmt lowering; minor HashMap type cleanups. Build + PyVM stage-2 smokes passed. 2025-09-17 02:50:39 +09:00
f2ffa30645 selfhost: implement script args passthrough (argv after -- → NYASH_SCRIPT_ARGS_JSON → Main.main(args)); interpreter: support ArrayBox.of and inject args; runner: prefer child compiler with --read-tmp 2025-09-17 01:55:08 +09:00
d3103cead8 cli: add --stage3 flag to enable Stage-3 acceptance for selfhost parser (sets NYASH_NY_COMPILER_STAGE3=1) 2025-09-17 01:24:22 +09:00
adbfbb2c76 ci: add GitHub Actions workflow; runner: prefer PyVM in selfhost paths; stage3: add LLVM + bridge acceptance smokes; docs: update env flags 2025-09-17 01:20:15 +09:00
5c9213cd03 smokes: add curated LLVM runner; archive legacy smokes; PHI-off unified across Bridge/Builder; LLVM resolver tracing; minimal Throw lowering; config env getters; dev profile and root cleaner; docs updated; CI workflow runs curated LLVM (PHI-on/off) 2025-09-16 23:49:36 +09:00
97a76c0571 selfhost: stub stage3 parser nodes under gate 2025-09-16 18:36:54 +09:00
fa1619bf4b selfhost: add ternary parser and plugin prefix guard 2025-09-16 17:38:22 +09:00
fce0d2cdef docs: log parser/emitter Stage-2 update 2025-09-16 17:11:03 +09:00
7db2c24808 selfhost: harden parser Stage-2 defaults 2025-09-16 17:10:27 +09:00
63c8fda808 🔍 Research: GPT-5-Codex capabilities and GitHub PR integration
## Summary
Investigated OpenAI's new GPT-5-Codex model and Codex GitHub PR review integration capabilities.

## GPT-5-Codex Analysis

### Benchmark Performance (Good)
- SWE-bench Verified: 74.5% (vs GPT-5's 72.8%)
- Refactoring tasks: 51.3% (vs GPT-5's 33.9%)
- Code review: Higher developer ratings

### Real-World Issues (Concerning)
- Users report degraded coding performance
- Scripts that previously worked now fail
- Less consistent than GPT-4.5
- Longer response times (minutes vs instant)
- "Creatively and emotionally flat"
- Basic errors (e.g., counting letters incorrectly)

### Key Finding
Classic case of "optimizing for benchmarks vs real usability" - scores well on tests but performs poorly in practice.

## Codex GitHub PR Integration

### Setup Process
1. Enable MFA and connect GitHub account
2. Authorize Codex GitHub app for repos
3. Enable "Code review" in repository settings

### Usage Methods
- **Manual**: Comment '@codex review' in PR
- **Automatic**: Triggers when PR moves from draft to ready

### Current Limitations
- One-way communication (doesn't respond to review comments)
- Prefers creating new PRs over updating existing ones
- Better for single-pass reviews than iterative feedback

## 'codex resume' Feature
New session management capability:
- Resume previous codex exec sessions
- Useful for continuing long tasks across days
- Maintains context from interrupted work

🐱 The investigation reveals that while GPT-5-Codex shows benchmark improvements, practical developer experience has declined - a reminder that metrics don't always reflect real-world utility\!
2025-09-16 16:28:25 +09:00
47f4ca0e44 📚 docs: Record field declaration design discussion in papers
## Summary
Documented the "init block vs fields-at-top" design discussion as a valuable example of AI-human collaboration in language design.

## Changes

### Paper G (AI Collaboration)
- Added field-declaration-design.md documenting the entire discussion flow
- Showcased how complex init block proposal evolved to simple "fields at top" rule
- Demonstrates AI's tendency toward complexity vs human intuition for simplicity

### Paper H (AI Practical Patterns)
- Added Pattern #17: "Gradual Refinement Pattern" (段階的洗練型)
- Documents the process: Complex AI proposal → Detailed analysis → Human insight → Convergence
- Field declaration design as a typical example

### Paper K (Explosive Incidents)
- Added Incident #046: "init block vs fields-at-top incident"
- Updated total count to 46 incidents
- Shows how a single human comment redirected entire design approach

## Design Decision
After analysis, decided that BoxIndex should remain a compiler-internal structure, not a core Box:
- Core Boxes: User-instantiable runtime values (String, Integer, Array, Map)
- Compiler internals: BoxIndex for name resolution (compile-time only)
- Clear separation of concerns between language features and compiler tools

## Philosophy
This discussion exemplifies key principles:
- The best design needs no explanation
- Constraints provide clarity, not limitation
- "Everything is Box" doesn't mean "compiler internals are Boxes"
- AI tends toward theoretical completeness; humans toward practical simplicity

🐱 Sometimes the simplest answer is right in front of us\!
2025-09-16 14:57:05 +09:00
6ca56b0652 feat: 配列/Mapリテラル糖衣構文の実装とネームスペース解決の改善計画
- ArrayLiteral/MapLiteralのAST定義追加
- パーサーで[...]と{...}構文をサポート
- MIR Builderでnew Box() + push/setへのdesugaring実装
- テストケースとスモークスクリプト追加
- CURRENT_TASK.mdにネームスペース解決Phase-1計画を追記
- 3段階解決順序(ローカル→エイリアス→プラグイン)の設計合意
2025-09-16 06:13:44 +09:00
18bc386bc5 chore: 未使用インポートの削除と軽微な警告修正 2025-09-16 04:23:20 +09:00
edd95406aa fix: aotモジュール公開とビルドエラー修正 2025-09-16 04:13:33 +09:00
40db299bab refactor: Gemini/ChatGPT collaborative refactoring + build fixes
Major changes:
- Split runner module: 1358→580 lines (via Gemini)
- Create new modules: dispatch.rs, selfhost.rs, pipeline.rs, pipe_io.rs
- Fix build errors from incomplete method migrations
- Add warning to CLAUDE.md about JIT/Cranelift not working
- Create interpreter.rs mode module
- Refactor loop builder into separate module

Build status:
-  Executable builds successfully
-  Basic execution works (tested with print)
- ⚠️ 106 warnings remain (to be cleaned up next)
- ⚠️ execute_mir_mode still in mod.rs (needs further migration)

Note: ChatGPT correctly fixed runner.execute_mir_mode() calls
that I incorrectly changed to super::modes::mir::

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 03:54:44 +09:00
f9bd13f4e4 docs: Update CURRENT_TASK.md with refactoring progress
- Add module splitting completion status (runner module)
- Record successful build after phi visibility fixes
- Update incident log with 4 new entries (042-045)
- Document PyVM vs EXE-first strategy confusion resolution
- Track Phase 15.3 (Nyash compiler MVP) progress

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 02:01:19 +09:00
ab76cd35fa refactor: 大規模なモジュールを分割し、コードの構造を改善
runner, mir/builder, backend/llvm の各モジュールが肥大化していたため、責務ごとにファイルを分割し、見通しを改善するリファクタリングを実施。

### `runner`
- `mod.rs` に集中していたロジックを、以下のモジュールに分割:
    - `tasks.rs`: `nyash.toml` のタスク実行処理
    - `build.rs`: AOTビルドパイプラインの実装
    - `pipeline.rs`: `using` の解決など、パイプライン中のユーティリティ
    - `demos.rs`: デモの実行処理

### `mir/builder`
- `if/else` 文のPHIノード生成ロジックを `stmts.rs` から `phi.rs` へ切り出し。
- `utils.rs` にあったPHI関連のヘルパーも `phi.rs` に集約。
- ASTから自由変数を収集するロジックを `vars.rs` へ切り出し。

### `backend/llvm/compiler/codegen`
- 巨大だった `lower_one_function` 関数を、`function.rs` モジュールとして分離。
- `sanitize_symbol` などのヘルパー関数を `utils.rs` へ移動。
2025-09-16 01:54:00 +09:00