I would like to write some code to parse mathematical expressions and
place the results into meaningful objects. Better yet, I'd rather use
someone else's code to do this! :-)
Sample line to parse: (pseudo-Maple-style syntax)
x * y + exp(x) = 5;
_Possible_ objects:
Variable x and y
Operator * and +
Constant 5
Function1Arg exp()
EqualSign =
Equation x * y + exp(x) = 5
Expression x * y, exp(x), 5, x * y + exp(x)
I am trying to write an OO solver, so ultimately, if I added another
equation like:
x + y = 4;
...I would want to be able to send my two Equation objects to a Solver
object.
My intent is that each semicolon would delimit an Equation; only one
EqualSign between semicolons.
Any help or pointers to help appreciated! Sample code would be great!
***
Side note for Smalltalkers (I'm a Smalltalker):
It would be cool if someone had code that would let me parse
x * y + exp(x) = 5;
adn create the Smalltalk block:
[:x :y | x * y + x exp - 5.0d]
***
Thanks,
Mark
______________________________________________________________________
Mark S. Johnson mjohnson@calpoly.edu
Mechanical Engineering Department http://www.calpoly.edu/~mjohnson/
California Polytechnic State University (805) 756-1386
San Luis Obispo, California 93407 fax (805) 756-1137
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:05 EST