#reverse-polish-notation #rpn #calc #notatio

laplade

RPN(Reverse Polish Notatio) library

3 releases

0.1.2 Feb 3, 2023
0.1.1 Feb 3, 2023
0.1.0 Feb 2, 2023

#4 in #notatio

MIT license

4KB
53 lines

RPN(Reverse Polish Notation) Calc

Reverse Polish notation (RPN) Calc.

Example

fn main() {
    let src = String::from("1 2 + 3 * ");
    let a = rpn_calc::eval(src).unwrap();
    println!("{}", a); // →9
}
fn main() {
    let result = rpn_calc::eval_str("1 2 3 * +");
    println!("{}", result); // →7
}

lib.rs:

RPN Calc

Reverse Polish notation (RPN) Calc.

Example

let src = String::from("1 2 + 3 * ");
let a = laplade::eval(src).unwrap();
println!("{}", a); // →9

No runtime deps