expr-solver-lib 1.0.2

A simple math expression solver library
Documentation
expr-solver-lib-1.0.2 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-lib = "1.0.2"

As a binary

Add this to your Cargo.toml:

[dependencies]
expr-solver-bin = "1.0.2"

Basic Example

use expr_solver::{Eval};

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

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

Testing

Run the test suite:

# Run all tests
cargo test

License

This project is licensed under the MIT License.