Wanted: Expression Evaluator

Doug McDonald mcdonald at aries.scs.uiuc.edu
Mon Feb 19 12:26:07 AEST 1990


In article <4365 at jarthur.Claremont.EDU> ssdken at jarthur.Claremont.EDU (Ken Nelson) writes:
>Hi:
>
>   I need the C source for an expression evaluator. Something that can
>   understand things like this:
>
>      A/B*LOG(D)
>
>
>   The evaluator would get A B and D from a symbol table, evaluate the 
>   expression and return the result.
>
>   Anybody have such a beast????
>
>
>			Thanks,
>
>
>				Ken Nelson
>				Principal Engineer
>				Software Systems Design
>				3627 Padua Av.
>				Claremont, CA 91711
>				(714) 624-3402
I have the guts of two, one an interpreter, one a compiler. The
compiler requires that your machine be able to execute data - 
many Unixes are seriously deficient in this regard. And, of
course, you have to put in the opcodes for your computer if you
want the compiler. The presently finished ones assume doubles. 
They have a very limited hard-coded set of symbols, but adding a 
symbol table lookup is trivial -  except, of course, you have to 
code in the symbol table at compile time. These will evaluate an 
expression of arbitrary complexity by recursive descent. They have
a fairly good syntax checker.

Interestingly, the code is amazingly small.

Send me e-mail if interested.

Doug McDonald (mcdonald at aries.scs.uiuc.edu)



More information about the Comp.lang.c mailing list