Module parser

Module parser 

Source
Expand description

Expression parser for mathematical expressions.

This module provides a parser for converting string representations of mathematical expressions into Expression objects.

§Supported Syntax

  • Numbers: 42, 3.14, -2.5, 1e-10
  • Variables: x, theta, alpha_1
  • Constants: pi, e, I (imaginary unit)
  • Operators: +, -, *, /, ^ (power)
  • Functions: sin, cos, tan, exp, log, sqrt, abs
  • Parentheses: (, )

§Examples

use quantrs2_symengine_pure::parser::parse;

let expr = parse("sin(x) + cos(y)").unwrap();
let expr2 = parse("x^2 + 2*x + 1").unwrap();

Functions§

parse
Parse a mathematical expression from a string.
parse_many
Parse multiple expressions separated by semicolons.