I actually decided to stop thinking about it and just go the route of porting JEval. Being in Java it translates pretty well to ActionScript, and it seems to be a pretty decent expression evaluator. I'm about 25% into it right now (just doing a straight port with minor adjustments along the way).
Of course, there are some aspects of JEval that I don't particularly like... it does seem a bit over-engineered in some areas, perhaps due to the fact that you can't create generic objects in Java or pass function pointers around (if memory serves), so everything is an object, even when it seems unnecessary. But, it works, and I realized I was spending more time researching the problem area than I would have spent if I had just done the mechanical process of porting it and be done with it. So, secondary question, do folks have a simple (numbers, strings and booleans only is fine) expression parser/evaluator in any language that they particularly like? Troy. On 3/12/07, Daniel Freiman <[EMAIL PROTECTED]> wrote:
If the expression is javascript compliant you can send it out to the browser using the ExternalInterface Class and call javascript's eval method. That wasn't going to work for me so I found that writing my own interpreter isn't bad if you've written an interpreter before. Otherwise I'm not sure I'd recommend it. Good luck. - Dan Freiman On 11 Mar 2007 12:31:11 -0700, Ralf Bokelberg <[EMAIL PROTECTED]> wrote: > > A really old one in ActionScript 1 can be found at > http://www.bokelberg.de/actionscript/experiments/eval.html > Cheers > Ralf > > On 11 Mar 2007 12:23:17 -0700, thirtyfivemph <[EMAIL PROTECTED]> > wrote: > > > > I'd like to add the ability for a user to enter an expression, e.g. > > "3+4*x+y*(z/3+4)" and be able to evaluate it. I've found plenty of > > examples in JavaScript, Java, C, C++, and about every other language > > out there... now, before I go start porting JEval (or similar) to > > ActionScript, is there something like this already out there? > > > > Thanks, > > > > Troy. > > > > > > > -- > Ralf Bokelberg <[EMAIL PROTECTED] > > Flex & Flash Consultant based in Cologne/Germany > Phone +49 (0) 221 530 15 35 >

