2025-08-09 15:14:44 +09:00
|
|
|
/*!
|
|
|
|
|
* Nyash Rust Implementation - Everything is Box in Memory Safe Rust
|
|
|
|
|
*
|
|
|
|
|
* This is the main entry point for the Rust implementation of Nyash,
|
|
|
|
|
* demonstrating the "Everything is Box" philosophy with Rust's ownership system.
|
2025-08-14 13:16:12 +00:00
|
|
|
*
|
|
|
|
|
* The main function serves as a thin entry point that delegates to the CLI
|
|
|
|
|
* and runner modules for actual processing.
|
2025-08-09 15:14:44 +09:00
|
|
|
*/
|
|
|
|
|
|
2025-08-14 13:16:12 +00:00
|
|
|
// Core modules
|
2025-08-09 15:14:44 +09:00
|
|
|
pub mod box_trait;
|
|
|
|
|
pub mod boxes;
|
2025-08-16 01:12:10 +09:00
|
|
|
pub mod stdlib;
|
2025-08-09 15:14:44 +09:00
|
|
|
pub mod environment;
|
|
|
|
|
pub mod tokenizer;
|
|
|
|
|
pub mod ast;
|
|
|
|
|
pub mod parser;
|
|
|
|
|
pub mod interpreter;
|
|
|
|
|
pub mod instance;
|
|
|
|
|
pub mod channel_box;
|
|
|
|
|
pub mod finalization;
|
|
|
|
|
pub mod exception_box;
|
|
|
|
|
pub mod method_box;
|
2025-08-11 03:25:49 +09:00
|
|
|
pub mod operator_traits;
|
2025-08-14 13:32:06 +00:00
|
|
|
pub mod box_arithmetic; // 🚀 Moved from box_trait.rs for better organization
|
2025-08-12 21:23:08 +00:00
|
|
|
pub mod value; // 🔥 NyashValue Revolutionary System
|
2025-08-16 01:12:10 +09:00
|
|
|
pub mod type_box; // 🌟 TypeBox revolutionary system
|
|
|
|
|
pub mod messaging; // 🌐 P2P Communication Infrastructure
|
|
|
|
|
pub mod transport; // 🌐 P2P Communication Infrastructure
|
2025-08-09 15:14:44 +09:00
|
|
|
|
2025-08-12 11:33:48 +00:00
|
|
|
// 🚀 MIR Infrastructure
|
|
|
|
|
pub mod mir;
|
2025-08-13 05:59:10 +00:00
|
|
|
|
|
|
|
|
// 🚀 Backend Infrastructure
|
|
|
|
|
pub mod backend;
|
2025-08-09 15:14:44 +09:00
|
|
|
|
2025-08-16 01:12:10 +09:00
|
|
|
// 📊 Performance Benchmarks
|
|
|
|
|
pub mod benchmarks;
|
|
|
|
|
|
2025-08-14 13:16:12 +00:00
|
|
|
// 🚀 Refactored modules for better organization
|
|
|
|
|
pub mod cli;
|
|
|
|
|
pub mod runner;
|
2025-08-09 15:14:44 +09:00
|
|
|
|
2025-08-18 11:07:03 +09:00
|
|
|
// BID-FFI / Plugin System (prototype)
|
|
|
|
|
pub mod bid;
|
|
|
|
|
|
2025-08-19 05:36:01 +09:00
|
|
|
use nyash_rust::cli::CliConfig;
|
2025-08-14 13:16:12 +00:00
|
|
|
use runner::NyashRunner;
|
2025-08-09 15:14:44 +09:00
|
|
|
|
2025-08-14 13:16:12 +00:00
|
|
|
/// Thin entry point - delegates to CLI parsing and runner execution
|
|
|
|
|
fn main() {
|
|
|
|
|
// Parse command-line arguments
|
|
|
|
|
let config = CliConfig::parse();
|
2025-08-14 07:19:23 +09:00
|
|
|
|
2025-08-14 13:16:12 +00:00
|
|
|
// Create and run the execution coordinator
|
|
|
|
|
let runner = NyashRunner::new(config);
|
|
|
|
|
runner.run();
|
2025-08-14 07:19:23 +09:00
|
|
|
}
|
|
|
|
|
|
2025-08-09 15:14:44 +09:00
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests {
|
|
|
|
|
use super::*;
|
2025-08-14 13:16:12 +00:00
|
|
|
use box_trait::{StringBox, BoxCore};
|
2025-08-09 15:14:44 +09:00
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_main_functionality() {
|
2025-08-14 13:16:12 +00:00
|
|
|
// This test ensures the module structure is correct
|
|
|
|
|
let string_box = StringBox::new("test".to_string());
|
2025-08-09 15:14:44 +09:00
|
|
|
assert_eq!(string_box.to_string_box().value, "test");
|
|
|
|
|
}
|
|
|
|
|
}
|