Re: parsing expressions
- Posted by David Cuny <dcuny at LANSET.COM> Jun 23, 1999
- 498 views
Geert-Jan Gerritsen wrote: > I'm looking for a way to evaluate mathematical expressions using > Euphoria. The application I'm developing asks the user to input a > math function, which has to be evaluated along the way. You know, > something like the good old VAL statement in Basic. There are a number of routines posted at the RDS site under: The Archive | Library Routines | Euphoria Expression Evaluator The Archive | Library Routines | Expression Evaluator The Archive | Simple Demos | Expression Evaluator The last library is my own, and was written for someone else to provide the sort of functionality you are asking for. I *think* that someone else had complained that the association was off if you didn't use parentheses, i.e.: a * b * c * d is evaluated as: ( ( a * b ) * c ) * d instead of: ( a * ( b * ( c * d ) I always use parens when I'm in doubt. If you plan on using mine, let me know if this is a problem, and I'll see if I can resolve it. -- David Cuny