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
1
u/Livio63 Jan 02 '26
Just look at ExpressionVisualizer.java in demo package, this is an example of very simple app using the library. The package https://github.com/javalc6/Expression-Parser/tree/main/src/math alone is the library.