uni_core/lib.rs
1//! # Uni Core
2//!
3//! Core interpreter for the Uni programming language - a homoiconic stack-based language
4//! that unifies code and data through cons cells and immediate execution.
5//!
6//! This library provides the core language implementation without platform-specific I/O,
7//! making it suitable for embedding in other applications or for use on embedded systems.
8//!
9//! ## Features
10//!
11//! - **no_std compatible**: Works on embedded systems without the Rust standard library
12//! - **Homoiconic**: Code and data have identical representation
13//! - **Stack-based**: All operations work with a central computation stack
14//! - **Tail-call optimized**: Continuation-based evaluator enables infinite recursion
15//! - **Multiple numeric types**: Integers, rationals, floats, and complex numbers
16//!
17//! ## Example
18//!
19//! ```
20//! use uni_core::{Interpreter, execute_string};
21//!
22//! let mut interp = Interpreter::new();
23//!
24//! // Execute some Uni code
25//! execute_string("5 3 +", &mut interp).unwrap();
26//!
27//! // Check the result
28//! assert_eq!(interp.stack.len(), 1);
29//! ```
30//!
31//! ## Optional Features
32//!
33//! - `std` - Enables standard library support (required for desktop platforms)
34//! - `advanced_math` - Trigonometric functions, exp/log, rounding operations
35//! - `complex_numbers` - Complex number and Gaussian integer support
36//! - `datetime` - Date/time operations (requires `std`)
37
38#![cfg_attr(target_os = "none", no_std)]
39
40#[cfg(target_os = "none")]
41extern crate alloc;
42
43// Public modules
44pub mod output;
45pub mod value;
46pub mod interpreter;
47pub mod evaluator;
48pub mod parser;
49pub mod tokenizer;
50pub mod builtins;
51pub mod prelude;
52pub mod primitives;
53pub mod hardware;
54
55// Internal module
56mod compat;
57
58// Re-exports for convenience
59pub use interpreter::{Interpreter, DictEntry};
60pub use value::{Value, RuntimeError};
61pub use output::Output;
62pub use evaluator::execute_string;