Question: Symbolic Mathematical Processing (Parsing) Methodologies

v148rb5b@ubvms.cc.buffalo.edu (COLLIN MCCULLEY)
Tue, 15 Feb 1994 21:57:00 GMT

          From comp.compilers

Related articles
Question: Symbolic Mathematical Processing (Parsing) Methodologies v148rb5b@ubvms.cc.buffalo.edu (1994-02-15)
Re: Question: Symbolic Mathematical Processing (Parsing) Methodologies parrt@s1.arc.umn.edu (Terence Parr) (1994-02-17)
| List of all articles for this month |

Newsgroups: comp.compilers
From: v148rb5b@ubvms.cc.buffalo.edu (COLLIN MCCULLEY)
Keywords: interpreter, parse, question, comment
Organization: University at Buffalo
Date: Tue, 15 Feb 1994 21:57:00 GMT

I have written code in C which will take a mathematical expression
as a string like "3*x^2-(4*sin(x^y)" and given the values of the symbolic
variables in the expression are defined to have some value, will return
the value of the expression. Basically the code breaks down the string,
finds out what's going on and then performs the required operations.


Of course, it occurs to me that I am reinventing the wheel in
developing the algorithm to do this, since of course every compiler ever
known does the same thing. Thus, probably more correct and efficient ways
of doing what I've done have already been developed.


So I need some help. My area is engineering, not CS, so I don't
know where to get some good reference material on how to tackle this
problem. Can anyone here help?


My basic aim is this: this code will be used in a numerical
optimization routine, where the expression(s) in question will have to be
evaluated many times. Thus I need some efficient way of parsing the
expression and then being able to reevaluate it at different values of the
symbolic variables. The goal here is to allow these expressions to be
entered interactively and changed at will, without having the functions
being optimized built in to the code and recompiled each time these
functions change. I also don't want to limit this to just, say,
polynomial expressions where the polynomial with variable coefficients is
hard-coded into the program. Right now my symbolic processor does trig
and hyperbolic trig, log functions, basic binary operators and a few other
things (like binary minimum and maximum).


Thanks. Email if possible, and I'll summarize responses.
--------
Collin McCulley
Multidisciplinary Optimization and Concurrent Engineering Lab
University at Buffalo
V148RB5B@ubvms.cc.buffalo.edu and mcculley@eng.buffalo.edu
[I'd suggest compiling into a tokenized reverse polish and interpreting that.
-John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.