import gnu.jel.Evaluator;
import gnu.jel.CompiledExpression;
import gnu.jel.Library;
import gnu.jel.CompilationException;


public class eval_test {
   public static String eval(String str) throws Throwable {
      CompiledExpression expr_c = null;
      Class jlib[] = new Class[1];
      jlib[0] = Math.class;
      gnu.jel.Library lib =
            new gnu.jel.Library(jlib,null);
      expr_c = Evaluator.compile(str,lib);
      Object result = null;
      if(expr_c != null) {
         result = expr_c.evaluate(null);
      }
      String ret = null;
      if(result != null) ret = result.toString();
      return ret;
   }

   public static void main(String args[]) {
      try {
         StringBuffer buffer = new StringBuffer();
         for(int i = 0; i < args.length; i++) {
            if(buffer.length() != 0) buffer.append(" ");
            buffer.append(args[i]);
         }
         Object result = eval(buffer.toString());
         if(result != null) {
            System.out.print(result.toString() + "\n");
         }
      }
      catch(Throwable th) {
         th.printStackTrace(System.err);
      }
   }
}

