Files
hakorune/src/lib.rs
nyash-codex f9d100ce01 chore: Phase 25.1 完了 - LoopForm v2/Stage1 CLI/環境変数削減 + Phase 26-D からの変更
Phase 25.1 完了成果:
-  LoopForm v2 テスト・ドキュメント・コメント完備
  - 4ケース(A/B/C/D)完全テストカバレッジ
  - 最小再現ケース作成(SSAバグ調査用)
  - SSOT文書作成(loopform_ssot.md)
  - 全ソースに [LoopForm] コメントタグ追加

-  Stage-1 CLI デバッグ環境構築
  - stage1_cli.hako 実装
  - stage1_bridge.rs ブリッジ実装
  - デバッグツール作成(stage1_debug.sh/stage1_minimal.sh)
  - アーキテクチャ改善提案文書

-  環境変数削減計画策定
  - 25変数の完全調査・分類
  - 6段階削減ロードマップ(25→5、80%削減)
  - 即時削除可能変数特定(NYASH_CONFIG/NYASH_DEBUG)

Phase 26-D からの累積変更:
- PHI実装改善(ExitPhiBuilder/HeaderPhiBuilder等)
- MIRビルダーリファクタリング
- 型伝播・最適化パス改善
- その他約300ファイルの累積変更

🎯 技術的成果:
- SSAバグ根本原因特定(条件分岐内loop変数変更)
- Region+next_iパターン適用完了(UsingCollectorBox等)
- LoopFormパターン文書化・テスト化完了
- セルフホスティング基盤強化

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: ChatGPT <noreply@openai.com>
Co-Authored-By: Task Assistant <task@anthropic.com>
2025-11-21 06:25:17 +09:00

117 lines
3.5 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
Nyash Programming Language — Rust library crate.
Provides parser, MIR, backends, runner, and supporting runtime.
*/
// Allow referring to this crate as `nyash_rust` from within the crate, matching external paths.
extern crate self as nyash_rust;
// WebAssembly support
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
pub mod ast; // using historical ast.rs
pub mod box_arithmetic;
pub mod box_factory; // unified Box Factory
pub mod box_operators; // operator implementations for basic Box types
pub mod box_trait;
pub mod boxes;
pub mod channel_box;
pub mod core; // core models shared by backends
pub mod environment;
pub mod exception_box;
pub mod finalization;
pub mod instance_v2; // simplified InstanceBox implementation
pub mod method_box;
pub mod operator_traits; // trait-based operator overloading
pub mod parser; // using historical parser.rs
pub mod scope_tracker; // Box lifecycle tracking for VM
pub mod stdlib;
pub mod tokenizer;
pub mod type_box; // TypeBox system (arithmetic moved from box_trait.rs)
pub mod value;
pub mod messaging;
pub mod transport;
// MIR (Mid-level Intermediate Representation)
pub mod mir;
#[cfg(feature = "aot-plan-import")]
pub mod mir_aot_plan_import {
pub use crate::mir::aot_plan_import::*;
}
// Backends
pub mod backend;
// JIT functionality archived to archive/jit-cranelift/
pub mod semantics; // Unified semantics trait for MIR evaluation/lowering
pub mod benchmarks;
// BID-FFI / Plugin system (prototype)
pub mod bid;
// Configuration system
pub mod config;
// CLI system
pub mod cli;
// Runtime system (plugins, registry, etc.)
pub mod debug;
pub mod runner_plugin_init;
pub mod runtime;
// Unified Grammar scaffolding
pub mod grammar;
pub mod syntax; // syntax sugar config and helpers
// Execution runner (CLI coordinator)
pub mod runner;
pub mod runner_hv1_inline_guard {}
pub mod using; // using resolver scaffolding (Phase 15)
// Host providers (extern bridge for Hako boxes)
pub mod host_providers;
// Core providers (ring1) — expose providers tree for in-crate re-exports
pub mod providers;
// CABI PoC shim (20.36/20.37)
pub mod abi {
pub mod nyrt_shim;
}
// Expose the macro engine module under a raw identifier; the source lives under `src/macro/`.
#[path = "macro/mod.rs"]
pub mod r#macro;
#[cfg(target_arch = "wasm32")]
pub mod wasm_test;
#[cfg(test)]
pub mod tests;
// Re-export main types for easy access
pub use ast::{ASTNode, BinaryOperator, LiteralValue};
pub use box_arithmetic::{AddBox, CompareBox, DivideBox, ModuloBox, MultiplyBox, SubtractBox};
pub use box_factory::RuntimeError;
pub use box_trait::{BoolBox, IntegerBox, NyashBox, StringBox, VoidBox};
pub use boxes::console_box::ConsoleBox;
pub use boxes::debug_box::DebugBox;
pub use boxes::map_box::MapBox;
pub use boxes::math_box::{FloatBox, MathBox, RangeBox};
pub use boxes::null_box::{null, NullBox};
pub use boxes::random_box::RandomBox;
pub use boxes::sound_box::SoundBox;
pub use boxes::time_box::{DateTimeBox, TimeBox, TimerBox};
pub use channel_box::{ChannelBox, MessageBox};
pub use environment::{Environment, PythonCompatEnvironment};
pub use instance_v2::InstanceBox; // 🎯 新実装テストnyash_rustパス使用
pub use method_box::{BoxType, EphemeralInstance, FunctionDefinition, MethodBox};
pub use parser::{NyashParser, ParseError};
pub use tokenizer::{NyashTokenizer, Token, TokenType};
pub use type_box::{MethodSignature, TypeBox, TypeRegistry}; // 🌟 TypeBox exports
pub use value::NyashValue;
// WASM support to be reimplemented with VM/LLVM backends