#rpn #reverse-polish-notation #parser #single-digit

single-digit-rpn

Calculate single digit Reverse Polish Notation

1 unstable release

0.1.0 Jun 14, 2020

#21 in #rpn

MIT license

12KB
280 lines

Single digit Reverse Polish Notation

Build Status

This package is a single digit RPN calculator. Only single digit RPN is supported:

123++ => 1 + (2 + 3)
4 5 3 - * => 4 * (5 - 3)
7 8*9- => 7 * 8 - 9

Usage

extern crate single_digit_rpn;
use single_digit_rpn::rpn;

let result: f64 = rpn("123++").unwrap();
assert_eq!(result, 6.0);

Examples

You can find example code in the examples directory.

To execute it, do the folloing:

cargo run --example cli

No runtime deps