|newbie question on Bison/Yacc firstname.lastname@example.org (2000-12-31)|
|Re: newbie question on Bison/Yacc email@example.com (Martin von Loewis) (2001-01-04)|
|From:||Martin von Loewis <firstname.lastname@example.org>|
|Date:||4 Jan 2001 01:00:18 -0500|
|Organization:||Humboldt University Berlin, Department of Computer Science|
|Posted-Date:||04 Jan 2001 01:00:18 EST|
> I am totally new to yacc/bison and wondering if you could help me with
> the following question: I need to parse an algebraic expression and
> calculate its value at a bunch of different points; what are the ways
> (the fastest way?) to reset the "independent vars" and recalculate the
> expression again?
I recommend to build a "symbol table", which maps variable names to
their assigned values. How efficient that is is not really a matter of
bison; you need a fast way to find an identifier in the symbol table
(e.g. by hashing), and you probably need a fast way to clear part of
the variable names when there scope is left (e.g. by chaining multiple
symbol tables, and then discarding the innermost one).
Return to the
Search the comp.compilers archives again.