C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Parser library for input of function (object)

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Michael Hopkins
Guest





PostPosted: Wed Oct 26, 2005 1:16 pm    Post subject: Parser library for input of function (object) Reply with quote





Hi all

I am looking around to find a C++ library that will allow me to load the
definition of a function from a file and turn this into a callable function
or functor for use within an already compiled program. The function
signature would almost always be of the form:

double function( double* x )

As an example, for the Cauchy density function:

1.0/( pi * ( 1.0 + x^2 ))

....the file could contain something like:

1 # the number of independent variables - might make things easier
1.0 / ( PI * ( 1.0 + SQR( _x1 ) ) )


Thanks in advance for any ideas or pointers and feel free to CC replies to
this email

Michael


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

_/ _/ _/_/_/ Hopkins Research Ltd
_/ _/ _/ _/
_/_/_/_/ _/_/_/ http://www.hopkins-research.com/
_/ _/ _/ _/
_/ _/ _/ _/ 'touch the future'

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Valentin Samko
Guest





PostPosted: Wed Oct 26, 2005 11:16 pm    Post subject: Re: Parser library for input of function (object) Reply with quote



Michael Hopkins wrote:
Quote:
Hi all

I am looking around to find a C++ library that will allow me to load the
definition of a function from a file and turn this into a callable function
or functor for use within an already compiled program. The function
signature would almost always be of the form:

Try http://warp.povusers.org/FunctionParser/ .

--

Valentin Samko - http://val.samko.info

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Tony Delroy
Guest





PostPosted: Thu Oct 27, 2005 11:14 am    Post subject: Re: Parser library for input of function (object) Reply with quote



Hi Michael,

Valentin's suggestion seems by far the best, but if you encounter
problems or need more power you could consider either CINT (see
http://root.cern.ch/root/Cint.html) , or (probably only practical if
your app is for a few in-house users) actually calling the C++ compiler
from your program, and dynamically linking the library/ies it produces.

Cheers,

Tony


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
mlybbert
Guest





PostPosted: Thu Oct 27, 2005 2:55 pm    Post subject: Re: Parser library for input of function (object) Reply with quote

/* I am looking around to find a C++ library that will allow me to load
the definition of a function from a file and turn this into a callable
function or functor for use within an already compiled program.
*/

You're probably not going to find what you want in C++. You may
consider Lua ([url]www.lua.org)[/url], Perl ([url]www.perl.com)[/url], Python
([url]www.python.org)[/url], TOOL ([url]www.codeproject.com/tools/ToolPublic.asp)[/url], or
another interpreted language.

Otherwise, you'll be looking at getting a parser, such as Boost.Spirit
(www.boost.org/libs/spirit/) or YARD (www.ootl.org/yard/) to read the
file, and then you'd roll your own virtual machine -- effectively
making an interpreted language.

My suggestion, btw, is Lua.


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Roland Pibinger
Guest





PostPosted: Fri Oct 28, 2005 9:03 am    Post subject: Re: Parser library for input of function (object) Reply with quote

On 26 Oct 2005 09:16:34 -0400, Michael Hopkins
<michael.hopkins (AT) hopkins-research (DOT) com> wrote:
Quote:
I am looking around to find a C++ library that will allow me to load the
definition of a function from a file and turn this into a callable function
or functor for use within an already compiled program. The function
signature would almost always be of the form:

double function( double* x )

Maybe this?
http://www.codeproject.com/cpp/FastMathParser.asp

Best wishes,
Roland Pibinger

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.