Java library for parsing and constructing logical expressions

I am looking for an open source library in Java to parse and build sql-like expressions.

for example, to evaluate the validity of expressions like:

 "(a = x or y ) and (b != z)"

In addition, I want to have an API to create or extend expressions. sort of:

Expression exp = new Expression();
exp.addCondition("a",{"x","y"},Operator.OR);

It's not so difficult to implement such a library, but aren't we developing in Java to enjoy collaborative development?

thanks

+3
source share
1 answer

I am sure you can ANTLR do this for you.

Grammar looks very simple (from here): P

+4
source

All Articles