tags:

views:

72

answers:

3

I'm looking for a really simple / limited scripting language for the JVM or the Bean Scripting Framework but can't find any.

I need the following operators:

  • +
  • -
  • *
  • /
  • maybe ** (power)
  • maybe sqrt

... and the ability to define Double type variables to create expressions like

(A+B)/2

The script may not call any JVM code (maybe with the exception of a Math class, but that's optional).

What options do i have?

I know I could just write that kind of thing myself, but I would prefer a tested, stable and fast solution. I tried Groovy before and really like it... but it's hard no to give my users the full power over the JVM with it.

A: 

Try BeanShell. It's super simple and has the same syntax as Java (although you can generally use shorthand bean accesor notation). It's a great tool for embedding debugging and management capabilities into a running JVM.

Joel
+1  A: 

check out FScript, maybe

trigan-d
looks like the best option yet, althrough they seem to allow access to java classes in the latest version. but I'll try using an older version of it. Thanks!!
arturh
+2  A: 

There are no language that are as simple as I need them, so I will define one myself using ANTLR. The best example I found so far is in this answer.

arturh