string evaluation: FORTRAN OR C ..
Hi guys,
how can we evaluate/convert the string in this case... a = ' x + y ' - as string!! x=3.2 y=2.1 How can I make "a" return 5.3??? I work with FORTRAN, but a solution in C is also welcome ... Regards Slackie1000 |
what you need amongst other things is a parser, not the easiest thing to write, theres a c++ book at www.relisoft.com that talks you through the implementation of one but they use a lot of c++ concepts. i seem to remember reading an article by jack crenshaw about building a compiler in pascal, its hosted on a comp.compilers mirror somewhere, the majority of that would be quite useful and being in pascal should be easy to port. if your not interested in writing one but just using one im sure you could grab something off sourceforge and link it into your program.
|
Quote:
|
exact....
the target is that... i need to find the "=" symbol and then evaluate the expression.. i would like to implement that also... anyway it will be very useful if I could see your code.. i will contact you.. thx... Regards Slackie1000 |
All times are GMT -5. The time now is 04:20 AM. |