[email protected] wrote: > Hi guys , > I have a parameter file that holds formulae on how to calculate some > charges , commissions ... > I expect formulae in various combination as below : > "(VAR.A * VAR.B) / 1000" > "(VAR.C + VAR.B) / 1000" > "(VAR.B - VAR.D) * 1000" > "(VAR.A * VAR.B) / 1000" > I intend replacing the VARs by the values dynamically in the formula > This means that at run time the formula variable will have values such > as : > "(100 * 300) / 1000" > "(900 *+ 200) / 1000" > "(100 *- 30) / 1000" > Is there in jbase a way of evaluating mathematical expressions > contained in a variable , without the peine of parsing it , and > checking which arithmetical operator is being used , so on and so > forth > > If so , how can i go about it , > When you get to the point where this question makes sense, I am afraid that it means your program design is very incorrect. You need to rethink what you are doing, or rather, the way you are doing it. Don't store your formulae as things you need to parse, but as parameters.
If you really need to parser something, then I highly recommend www.antlr.org. The C output of this program is particularly good. Like the author, it is both handsome and clever :-) Jim --~--~---------~--~----~------------~-------~--~----~ Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24 To post, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jBASE?hl=en -~----------~----~----~----~------~----~------~--~---
