Skip to content

CrimsonAndRed/MyLittleExpression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Expression Solver

This small project is capable of solving simple formulas! It may be used to solve expressions in different notaitons, even not usual ones (see this example).

Usage

Add the following line to Cargo.toml file:

expression_parser = { git = "https://github.com/CrimsonAndRed/MyLittleExpression" }

To calculate an expression follow the code below:

use expression_parser::config::ParserConfig;

fn main() {
    // Define ParserConfig for given numeric type.
    let mut pc = ParserConfig::<i64>::default();
    // Add operators to ParserConfig.
    pc.with_basic_math();
    // Parse the expression.
    let result = pc.parse("1 + 1");
    println!("{:?}", result);
}

TODO

  • variables as strings
  • comments

About

Simple expression solver

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages