1. parsing expressions
------=_NextPart_000_0012_01BEBD89.B573FFC0
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi everybody,
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.
Can you help me?
Geert-Jan Gerritsen
The Netherlands
gejege at tip.nl
------=_NextPart_000_0012_01BEBD89.B573FFC0
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>Hi everybody,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2>I'm looking for a way to evaluate mathematical =
expressions=20
using Euphoria. The application I'm developing asks the user to input a =
math=20
function, which has to be evaluated along the way. You know, something =
like the=20
good old VAL statement in Basic.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2>Can you help me?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2>Geert-Jan Gerritsen</FONT></DIV>
<DIV><FONT size=3D2>The Netherlands</FONT></DIV>
<DIV><FONT size=3D2><A =
------=_NextPart_000_0012_01BEBD89.B573FFC0--
2. Re: parsing expressions
On Wed, 23 Jun 1999, 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.
I thought there was more than just this at the Euphoria site, but this is
all I could find there:
http://members.aol.com/FilesEu/archive2.htm#MATH
Second link down.
HTH,
Carl
--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail........: cyrek- at -bigfoot.com -- Remove hyphens. Ta :)
URL...........: http://www.bigfoot.com/~cyrek/
Uncrackable...: "19.6A.23.38.52.73.45 25.31.1C 3C.53.44.39.58"
3. Re: parsing expressions
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