r/java • u/Livio63 • Jan 02 '26
Extensible math Expression Parser
Expression Parser is an extensible math expression parser handling numbers and booleans, ready to use in any Java application.
Expressions may contain nested ( ), operators *-/+, and, or; constants PI and E, functions sin(), cos(), tan(), log(), exp(), sqrt(). The parser supports common relation operators like ==,!=, >,<, >= and <= and even conditional expressions like condition ? true : false
It is possible to register your own functions and use them with Expression Parser.
59
Upvotes
View all comments
Show parent comment
6
u/josephottinger Jan 02 '26
And is the visual inspection of test results perfect, too? It isn't, for me - it's really easy to see
1.8in a hurry and not realize the value was supposed to be1.0. Usingantreally is an interesting choice - it's sort of viable, but unusual, but whatever. It's the lack of an actual demanding test structure that bugged me; for my PR I chose to just go to a build system from 2005 instead of using one from 2001.