Skip to content

AscendingCreations/tinyexpr-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyexpr-rs

Crates.io Documentation Build Status Build status Coverage Status

Tiny recursive descent expression parser, compiler, and evaluation engine for math expressions.

This is a WIP port of TinyExpr to Rust. Current release only supports built-in system functions (trigonometry, algebraic operations, constants, etc.). See the tests module for more examples.

Documentation

Usage

# Cargo.toml
[dependencies]
tinyexpr = { git = "https://git.codentium.com/Genusis/tinyexpr-rs" }

Example

extern crate tinyexpr;

fn main()
{
    // parse the expression and fetch result
    let r = tinyexpr::interp("2+2*2").unwrap();

    // should print "6"
    println!("{:?}", r);
}

Build instructions

cargo build
cargo run --example tinyexpr

Todo

  • support custom user functions
  • support functions taking more than 2 parameters
  • support closures

License

Licensed under either of

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published