Expand description
TinyExpr is a tiny recursive descent expression parser, compiler, and evaluation engine for math expressions. This is a work in progress port of TinyExpr to Rust.
Current release only supports built-in system functions (trigonometry, algebraic operations, constants, etc.).
See the tests
module for more examples.
§Quick Start
extern crate tinyexpr;
fn main()
{
// parse the expression and fetch result
let r = tinyexpr::interp("2+2*2").unwrap();
// should print "6"
println!("{:?}", r);
}
Modules§
- error
- Error type for tinyexpr crate.
Constants§
- TE_
CLOSUR E0 - TE_
CLOSUR E1 - TE_
CLOSUR E2 - TE_
CLOSUR E3 - TE_
CLOSUR E4 - TE_
CLOSUR E5 - TE_
CLOSUR E6 - TE_
CLOSUR E7 - TE_
CONSTANT - TE_
FLAG_ PURE - TE_
FUNCTIO N0 - TE_
FUNCTIO N1 - TE_
FUNCTIO N2 - TE_
FUNCTIO N3 - TE_
FUNCTIO N4 - TE_
FUNCTIO N5 - TE_
FUNCTIO N6 - TE_
FUNCTIO N7 - TE_
VARIABLE - TOK_
CLOSE - TOK_END
- TOK_
ERROR - TOK_
INFIX - TOK_
NULL - TOK_
NUMBER - TOK_
OPEN - TOK_SEP
- TOK_
VARIABLE - T_MASK
Functions§
- interp
- Interprets a string expression as a mathematical expresion, evaluates it and returns its result.