expr-solver-lib 1.0.0

A simple math expression solver library
Documentation
expr-solver-lib-1.0.0 has been yanked.

expr-solver

A simple mathematical expression solver library written in Rust.

Features

  • Evaluate simple math expressions
  • Register custom constants and functions
  • Proper error handling with source location information
  • Compilation to bytecode with serialization support
  • Stack-based virtual machine for efficient execution

Usage

As a Library

Add this to your Cargo.toml:

[dependencies]
expr-solver = "0.1.0"

Basic Example

use expr_solver::{Eval};

fn main() {
    let mut eval = Eval::new("2+3*4");
    match eval.eval() {
        Ok(result) => println!("Result: {}", result),
        Err(e) => eprintln!("Error: {}", e),
    }
    
}

As a Binary

Run expressions from the command line:

cargo run

This will evaluate the hardcoded expression 2 + 3 * 4 and print the result.

Testing

Run the test suite:

# Run all tests
cargo test

# Run only unit tests
cargo test --lib

# Run only integration tests
cargo test --test integration_tests

# Run doc tests
cargo test --doc

License

This project is licensed under the MIT License.