Expand description
Runtime expression parser — convert strings to symbolic expressions. Runtime expression parser.
Parses mathematical expressions from strings into the arena.
Uses a Pratt parser (precedence climbing) with the same grammar
as the expr! proc macro:
- Operators:
+,-,*,/,^(right-associative) - Unary:
-(prefix negation) - Functions:
sin,cos,tan,exp,ln,sqrt,abs - Parentheses:
(,) - Atoms: integer literals, symbol names
- Constants:
pi,e,I,inf,nan
§Examples
use symplex::prelude::*;
let ctx = Context::new();
let expr = symplex::parse::parse(&ctx, "x^2 + 2*x + 1").unwrap();
assert_eq!(format!("{expr}"), "x^2 + 2*x + 1");Structs§
- Parse
Error - Error returned when parsing fails.
Functions§
- parse
- Parse a mathematical expression string into an
Ex.