2025-09-17 07:43:07 +09:00
|
|
|
|
/*!
|
2025-09-20 09:11:52 +09:00
|
|
|
|
Nyash Programming Language — Rust library crate.
|
|
|
|
|
|
Provides parser, MIR, backends, runner, and supporting runtime.
|
|
|
|
|
|
*/
|
2025-08-09 15:14:44 +09:00
|
|
|
|
|
2025-09-21 08:53:00 +09:00
|
|
|
|
// Allow referring to this crate as `nyash_rust` from within the crate, matching external paths.
|
|
|
|
|
|
extern crate self as nyash_rust;
|
|
|
|
|
|
|
2025-09-20 09:11:52 +09:00
|
|
|
|
// WebAssembly support
|
2025-08-09 15:14:44 +09:00
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
|
|
2025-09-20 09:11:52 +09:00
|
|
|
|
pub mod ast; // using historical ast.rs
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod box_arithmetic;
|
2025-09-20 09:11:52 +09:00
|
|
|
|
pub mod box_factory; // unified Box Factory
|
|
|
|
|
|
pub mod box_operators; // operator implementations for basic Box types
|
2025-08-09 15:14:44 +09:00
|
|
|
|
pub mod box_trait;
|
|
|
|
|
|
pub mod boxes;
|
|
|
|
|
|
pub mod channel_box;
|
2025-09-20 09:11:52 +09:00
|
|
|
|
pub mod core; // core models shared by backends
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod environment;
|
2025-08-09 15:14:44 +09:00
|
|
|
|
pub mod exception_box;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod finalization;
|
2025-09-20 09:11:52 +09:00
|
|
|
|
pub mod instance_v2; // simplified InstanceBox implementation
|
2025-08-09 15:14:44 +09:00
|
|
|
|
pub mod method_box;
|
2025-09-20 09:11:52 +09:00
|
|
|
|
pub mod operator_traits; // trait-based operator overloading
|
|
|
|
|
|
pub mod parser; // using historical parser.rs
|
|
|
|
|
|
pub mod scope_tracker; // Box lifecycle tracking for VM
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod stdlib;
|
|
|
|
|
|
pub mod tokenizer;
|
2025-09-20 09:11:52 +09:00
|
|
|
|
pub mod type_box; // TypeBox system (arithmetic moved from box_trait.rs)
|
2025-08-09 15:14:44 +09:00
|
|
|
|
|
2025-08-12 10:08:30 +00:00
|
|
|
|
pub mod value;
|
|
|
|
|
|
|
2025-08-12 01:35:36 +00:00
|
|
|
|
pub mod messaging;
|
|
|
|
|
|
pub mod transport;
|
|
|
|
|
|
|
2025-09-20 09:11:52 +09:00
|
|
|
|
// MIR (Mid-level Intermediate Representation)
|
2025-08-12 11:33:48 +00:00
|
|
|
|
pub mod mir;
|
2025-09-07 07:36:15 +09:00
|
|
|
|
#[cfg(feature = "aot-plan-import")]
|
|
|
|
|
|
pub mod mir_aot_plan_import {
|
|
|
|
|
|
pub use crate::mir::aot_plan_import::*;
|
|
|
|
|
|
}
|
2025-08-12 11:33:48 +00:00
|
|
|
|
|
2025-09-20 09:11:52 +09:00
|
|
|
|
// Backends
|
2025-08-13 10:26:46 +00:00
|
|
|
|
pub mod backend;
|
2025-09-24 21:57:12 +09:00
|
|
|
|
// JIT functionality archived to archive/jit-cranelift/
|
2025-09-01 23:44:34 +09:00
|
|
|
|
pub mod semantics; // Unified semantics trait for MIR evaluation/lowering
|
2025-08-13 10:26:46 +00:00
|
|
|
|
|
2025-08-14 07:19:23 +09:00
|
|
|
|
pub mod benchmarks;
|
|
|
|
|
|
|
2025-08-18 11:07:03 +09:00
|
|
|
|
// BID-FFI / Plugin system (prototype)
|
|
|
|
|
|
pub mod bid;
|
|
|
|
|
|
|
2025-08-19 03:48:44 +09:00
|
|
|
|
// Configuration system
|
|
|
|
|
|
pub mod config;
|
|
|
|
|
|
|
2025-08-19 05:36:01 +09:00
|
|
|
|
// CLI system
|
|
|
|
|
|
pub mod cli;
|
|
|
|
|
|
|
2025-08-19 03:48:44 +09:00
|
|
|
|
// Runtime system (plugins, registry, etc.)
|
2025-08-26 05:49:23 +09:00
|
|
|
|
pub mod debug;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod runner_plugin_init;
|
|
|
|
|
|
pub mod runtime;
|
2025-09-20 09:11:52 +09:00
|
|
|
|
// Unified Grammar scaffolding
|
2025-09-02 17:12:51 +09:00
|
|
|
|
pub mod grammar;
|
2025-09-20 09:11:52 +09:00
|
|
|
|
pub mod syntax; // syntax sugar config and helpers
|
2025-09-21 08:53:00 +09:00
|
|
|
|
// Execution runner (CLI coordinator)
|
|
|
|
|
|
pub mod runner;
|
2025-09-24 21:45:27 +09:00
|
|
|
|
pub mod using; // using resolver scaffolding (Phase 15)
|
2025-09-21 08:53:00 +09:00
|
|
|
|
|
|
|
|
|
|
// Expose the macro engine module under a raw identifier; the source lives under `src/macro/`.
|
|
|
|
|
|
#[path = "macro/mod.rs"]
|
|
|
|
|
|
pub mod r#macro;
|
2025-08-19 03:48:44 +09:00
|
|
|
|
|
2025-08-09 15:14:44 +09:00
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
|
|
pub mod wasm_test;
|
|
|
|
|
|
|
2025-08-10 03:28:59 +00:00
|
|
|
|
#[cfg(test)]
|
|
|
|
|
|
pub mod tests;
|
|
|
|
|
|
|
2025-08-09 15:14:44 +09:00
|
|
|
|
// Re-export main types for easy access
|
|
|
|
|
|
pub use ast::{ASTNode, BinaryOperator, LiteralValue};
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use box_arithmetic::{AddBox, CompareBox, DivideBox, ModuloBox, MultiplyBox, SubtractBox};
|
|
|
|
|
|
pub use box_trait::{BoolBox, IntegerBox, NyashBox, StringBox, VoidBox};
|
|
|
|
|
|
pub use environment::{Environment, PythonCompatEnvironment};
|
2025-09-24 09:30:42 +09:00
|
|
|
|
pub use box_factory::RuntimeError;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use parser::{NyashParser, ParseError};
|
|
|
|
|
|
pub use tokenizer::{NyashTokenizer, Token, TokenType};
|
|
|
|
|
|
pub use type_box::{MethodSignature, TypeBox, TypeRegistry}; // 🌟 TypeBox exports
|
|
|
|
|
|
pub use boxes::console_box::ConsoleBox;
|
|
|
|
|
|
pub use boxes::debug_box::DebugBox;
|
2025-08-09 15:14:44 +09:00
|
|
|
|
pub use boxes::map_box::MapBox;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use boxes::math_box::{FloatBox, MathBox, RangeBox};
|
|
|
|
|
|
pub use boxes::null_box::{null, NullBox};
|
2025-08-09 15:14:44 +09:00
|
|
|
|
pub use boxes::random_box::RandomBox;
|
|
|
|
|
|
pub use boxes::sound_box::SoundBox;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use boxes::time_box::{DateTimeBox, TimeBox, TimerBox};
|
|
|
|
|
|
pub use channel_box::{ChannelBox, MessageBox};
|
|
|
|
|
|
pub use instance_v2::InstanceBox; // 🎯 新実装テスト(nyash_rustパス使用)
|
|
|
|
|
|
pub use method_box::{BoxType, EphemeralInstance, FunctionDefinition, MethodBox};
|
2025-08-09 15:14:44 +09:00
|
|
|
|
|
2025-08-12 10:08:30 +00:00
|
|
|
|
pub use value::NyashValue;
|
|
|
|
|
|
|
2025-09-24 21:57:12 +09:00
|
|
|
|
// WASM support to be reimplemented with VM/LLVM backends
|