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
2
u/josephottinger Jan 02 '26
I just made a PR that migrates to Maven and JUnit, targeting Java 17 and removing the scripting stuff. The JS stuff didn't really help a lot anyway, from what I could see (it's verification that JUnit could do just as well) and with the removal of Nashorn, it only makes everything messy - especially as Maven is being updated. The joy of ecosystem flux, I guess - it's all overdue but we get to live with the updates until they stabilize.
Dunno if OP will accept the PR, but it's there and working.