Crate uni_core

Crate uni_core 

Source
Expand description

§Uni Core

Core interpreter for the Uni programming language - a homoiconic stack-based language that unifies code and data through cons cells and immediate execution.

This library provides the core language implementation without platform-specific I/O, making it suitable for embedding in other applications or for use on embedded systems.

§Features

  • no_std compatible: Works on embedded systems without the Rust standard library
  • Homoiconic: Code and data have identical representation
  • Stack-based: All operations work with a central computation stack
  • Tail-call optimized: Continuation-based evaluator enables infinite recursion
  • Multiple numeric types: Integers, rationals, floats, and complex numbers

§Example

use uni_core::{Interpreter, execute_string};

let mut interp = Interpreter::new();

// Execute some Uni code
execute_string("5 3 +", &mut interp).unwrap();

// Check the result
assert_eq!(interp.stack.len(), 1);

§Optional Features

  • std - Enables standard library support (required for desktop platforms)
  • advanced_math - Trigonometric functions, exp/log, rounding operations
  • complex_numbers - Complex number and Gaussian integer support
  • repl - Enables REPL (Read-Eval-Print Loop) functionality with line editing

Re-exports§

pub use interpreter::Interpreter;
pub use interpreter::DictEntry;
pub use value::Value;
pub use value::RuntimeError;
pub use output::Output;
pub use time_source::TimeSource;
pub use time_source::DateComponents;
pub use evaluator::execute_string;

Modules§

builtins
evaluator
hardware
Hardware-specific primitives for embedded targets
interpreter
output
parser
prelude
primitives
time_source
tokenizer
value