mini\Util\Math\ExprParser final class

Documentation

Infix to expression tree parser using shunting-yard algorithm

Supports:

  • Binary operators: +, -, *, /, %, **
  • Unary operators: -x, +x
  • Functions: sqrt(x), exp(x), ln(x), abs(x)
  • Parentheses
  • Decimal numbers

Constants (4)

Name Value
PRECEDENCE array ( '+' => 1, '-' => 1, '*' => 2, '/' => 2, '%' => 2, '**' => 3, 'neg' => 3, 'pos' => 3, 'sqrt' => 4, 'exp' => 4, 'ln' => 4, 'abs' => 4, )
RIGHT_ASSOC array ( 0 => '**', 1 => 'neg', 2 => 'pos', )
UNARY array ( 0 => 'neg', 1 => 'pos', 2 => 'sqrt', 3 => 'exp', 4 => 'ln', 5 => 'abs', )
FUNCTIONS array ( 0 => 'sqrt', 1 => 'exp', 2 => 'ln', 3 => 'abs', )

Properties (3)

private string $input
private int $pos
private int $len

Methods (9)

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Documentation missing

Try to read a function name

Documentation missing

Documentation missing

Source

src/Util/Math/Expr.php:1022-1275