JEL:
import gnu.jel.CompilationException;
import gnu.jel.CompiledExpression;
import gnu.jel.Evaluator;
import gnu.jel.Library;
public class Main {
private static final String EVAL_VALUE = "3243-854+6-100";
public static void main(String[] args){
JELSample();
}
private static void JELSample(){
try {
Class[] staticLib = new Class[1];
staticLib[0] = Class.forName("java.lang.Math");
Library lib = new Library(staticLib, null, null, null, null);
CompiledExpression compiledExpression = Evaluator.compile(EVAL_VALUE, lib);
Object result = compiledExpression.evaluate(null);
System.out.println("JEL: " + result);
} catch (CompilationException e) {
e.printStackTrace();
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
}