string from dialog to execute?

I would like to have a dialog box ask me for an equation. I would enter the equation and then I would like the script to take what I have entered and use it in a calculation.
For instance, in the dialog box I could enter sine of x. My script could be set to use x=3 for any equation. So the result would be .14. The next time I might enter x^3. Then the result would be 27. And so on.
How could I do this? I need to convert a string (the entered equation) into something executable. Any ideas?

: How could I do this? I need to convert a string (the
: entered equation) into something executable. Any
: ideas?
I to have asked this question. What you would need is a handler to parse the string into something usable. One person suggested that I write an OSAX, but I don’t know C. I do have a bit of parsing code in another language (Java) if you would like to look at it. It should be fairly simple to comprehend. E-mail me if you want the Java code.

I should tell you one work around that I have found: I getthe equation from the dialog box and write to to a textfile:

on f(x)
equation goes here
end f

Then I use ScriptServer to compile the file, then I load thecompiled file back into the original script and call thef(x) handler.
It works, but it is clunky, and I can’t help but feel thatthere has to be an easier way.
Tamara
: I would like to have a dialog box ask me for an equation.
: I would enter the equation and then I would like the
: script to take what I have entered and use it in a
: calculation.
: For instance, in the dialog box I could enter sine of x.
: My script could be set to use x=3 for any equation. So
: the result would be .14. The next time I might enter
: x^3. Then the result would be 27. And so on.
: How could I do this? I need to convert a string (the
: entered equation) into something executable. Any
: ideas?