I'm looking for an expression language that I can use in both Java and .NET projects. My project uses a java server and a C# UI, and we want to be able to create simple expressions that can be both parsed and executed in both languages.

It needs to have the following features:

  • Basic arithmetic: */+-
  • Variables and Literals
  • Boolean operators: AND, OR, NOT
  • Set membership functions (IN)
  • Complex Expressions e.g. (A+5 > X OR !B) AND Pow(C, 2) < 100
  • Parses into an AST
  • lightweight language specific for single line expressions (i.e. not Python, JavaScript etc.)

Nice to have would be:

  • General Set functions: Union/Intersection/Complement
  • Math/Trig functions
  • User defined functions (defined in Java or C#)
  • Array and Map support

I need the AST so that I can 1) translate the expressions into another language (SQL) and 2) display the expression tree graphically.

The closest I have found is Spring EL (http://www.springframework.net/doc-latest/reference/html/expressions.html, http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/expressions.html), but its unclear to me if the Java and .NET versions are compatible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.