[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-jel] Locate token in expression?

From: Mark Taylor
Subject: [Help-jel] Locate token in expression?
Date: Mon, 26 Nov 2018 15:57:11 +0000

Dear Konstantin,

in my application, the user can define a named value at run time
by supplying a JEL expression, and this name can be used in
subsequent definitions.  As a convenience, they can also
redefine an existing name by editing the expression.

So for instance one can define a name "A" as "B + C",
assuming that B and C are already known to JEL.
Later, one can redefine "A" as, e.g., "2*B + C".  So far so good.
However, if C has already been defined in terms of A, there's trouble:
the definition is recursive, and evaluation never terminates.

So, I want some way to catch this condition.  If I can analyse
the expression "2*B + C" to see whether it contains any
(explicit or implicit) reference to the name "A",
then I can issue an error message and prevent the user from
assigning the new expression as the value of "A".

I've had a look at the JEL API (though not the source code) and
I have some ideas of what might work ... but I'm not sure.
Is this possible with the existing API?  If so, could you give me
an outline of how to go about it?

Many thanks,


Mark Taylor   Astronomical Programmer   Physics, Bristol University, UK
address@hidden +44-117-9288776

reply via email to

[Prev in Thread] Current Thread [Next in Thread]