Over a million developers have joined DZone.

Jep 3.2 - Java Expression Parser

DZone's Guide to

Jep 3.2 - Java Expression Parser

· ·
Free Resource

JEP is a Java library for parsing and evaluating mathematical expressions. With this package you can allow your users to enter an arbitrary formula as a string, and instantly evaluate it. JEP supports user defined variables, constants, and functions. A number of common mathematical functions and constants are included.

As of February, a new release of Jep is available! We made a bunch of improvements to the configurable parser component, making it even more powerful than before. Additionally you can now analyse parsed expressions, parse multiple expressions separated by semi-colons, and much more.

See the Jep web site for more information: http://www.singularsys.com/jep

Changes from Jep 3.1 to 3.2:

General Changes:

  • Added support for expression tree analysis using TreeAnalyser
  • Fixed errors in the documentation of the default configuration
  • Improved the operator table

Changes to the configurable parser:

  • New StandardConfigurableParser class
  • Parse error reporting with line and column numbers
  • Added support for hexadecimal numbers (e.g. 0x1F)
  • Added support for bitwise operators (bitwise or: a | b, bit shifting a << 2) in BitwiseOperatorTable
  • Added support for a?b:c, x+=1, ++x syntax
  • Added support for case-insensitive operators
  • Added support for multiple expressions separated by semicolons
  • Added support for multiple dimensional array access (a[1][1] accesses the first element of a two-dimensional array)
  • Fixed issues with escape characters
  • Fixed power and unary minus precedence to be consistent with the standard parser ("-3^2" should equal -9)

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}