[comp.lang.pascal] evaluating

winfmni%DUTICAI.TUDELFT.NL@uga.cc.uga.edu (04/11/91)

Hi,

> Is it possible (and if so, how) to have a compiled Turbo Pascal
> program read an equation from an ascii file and process it as
> an equation?

As I recall, the Turbo Pascal package contains an example program
TCALC (a spreadsheet). Within the spreadsheet, there is a little
parser for evaluating expression, taking strings as input. That
should be a start. If you need *speed* though, consider translating
the string expression to a tree representation and evaluate the
tree (so that you won't have to parse the string over & over).
I have a version of the last code lying around somewhere, if you're
interested I can try to dig it up but it will take some time :-)

Hello!
--
Ir. M.H. Nieuwmans               | e-mail winfmni@duticai.tudelft.nl
Delft University of Technology   | Phone 31 15 783823; home 31 70 3914080
Department of Information Systems