Related articles |
---|
mathematical function parser/compiler jens.dreger@physik.fu-berlin.de (Jens Dreger) (1998-05-04) |
Re: mathematical function parser/compiler bernecky@acm.org (Robert Bernecky) (1998-05-07) |
Re: mathematical function parser/compiler f81@ix.urz.uni-heidelberg.de (Joerg Schoen) (1998-05-07) |
Re: mathematical function parser/compiler ramb@synopsys.com (Ram Bhamidipaty) (1998-05-12) |
From: | Robert Bernecky <bernecky@acm.org> |
Newsgroups: | comp.compilers |
Date: | 7 May 1998 16:53:26 -0400 |
Organization: | ICAN.Net Customer |
References: | 98-05-021 |
Keywords: | parse, interpreter |
Jens Dreger wrote:
> I'm looking for a c/c++ function, that takes some string like
> f(x)=1/(1+x^2)
> at runtime (!) and returns a function that evaluates this
> expression when called within the program. This sounds like a
> common problem, so I assume it has already been solved, but I
> couldn't find anything like that.
You might try calling a J interpreter DLL if you're in windoze (not sure
how their linux version works). J is an offshoot of APL
that has some very nice array handling facilities in it.
In J, you could write something along the lines of:
f=. 1 % 1+ y. ^2 NB. y. is the argument
then do:
f 10 20 40...
and execute foo on a whole array (not necessarily just a vector)
at once.
Look at http://www.jsoftware.com
Bob
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.