Skip to content
Ablaze-MIRAIPublic

About

A simple logical expression evaluation crate with RPN conversion

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

evalbit

A simple logical expression evaluation crate with RPN convertion

Crates.io Version

Quickstart

Add evalbit as dependency to your Cargo.toml:

[dependencies]
evalbit = "<desired version>"

Then you can use evalbit to parse and evaluate expressions like this:

use evalbit::*;

let expr = "0 | (1 ^ 2 & 3)"
let rpn = parse(expr);

assert_eq!(rpn.to_string(), "0 1 2 3 & ^ |");
assert_eq!(rpn.exec(&[true, true, false, false]), true);

// and you can directly execute
assert_eq!(eval("0 | (1 ^ 2 & 3)", &[true, true, false, false]), true));

Operators

The operator precedences are equal to Rust's ones.

License

This crate is published under the ISC License.

About

A simple logical expression evaluation crate with RPN conversion

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages