I need to allow my users to be able to define formulas which will calculate values based on data. For example
//Example 1
return GetMonetaryAmountFromDatabase("Amount due") * 1.2;
//Example 2
return GetMonetaryAmountFromDatabase("Amount due") * GetFactorFromDatabase("Discount");
I will need to allow / * + - operations, also to assign...
I'm writing an evaluator for a little expression language, but I'm stuck on the LetRec construct.
This is the language:
type Var = String
type Binds = [(Var, Expr)]
data Expr
= Var Var
| Lam Var Expr
| App Expr Expr
| Con Int
| Sub Expr Expr
| If Expr Expr Expr
| Let Var Expr Ex...
Hi,
We use the Jeks parser at present to evaluate expressions. I cannot see a way to evaluate string expressions with it - for example:
IF( "Test 1" = "Test 2")
Is there anything out there that can evaluate string and mathematical expressions in Java? Preferably free or open source.
Thanks for any help,
Andez
...