Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

math_eval

Personal project to learn Rust and develop a parsing algorithm.

The core of this project is the implementation of the Shunting Yard Algorithm, which is for parsing mathematical expressions written in infix notation. I implemented some tests to check if any new changes break the already defined rules. You can run the tests with cargo test.

Code example:

use math_eval::Parser;

fn main() {
    let input = String::from("(1 + 2*10)/(2+5)");
    let mut parser = Parser::new(&input);
    if let Some(item) = parser.result(){
        println!("{} = {}", input, item);
    }
}

Running cargo run the result is:

(1 + 2*10)/(2+5) = 3

About

A Rust library for evaluating mathematical expressions.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages