|Constant expression evaluation? mdhe51ATdialDOTpipexDOTcom@eu.uu.net (Paul Davis) (2003-05-14)|
|Re: Constant expression evaluation? firstname.lastname@example.org (Christian Bau) (2003-05-16)|
|Re: Constant expression evaluation? email@example.com (Dierk Ohlerich) (2003-05-16)|
|Re: Constant expression evaluation? firstname.lastname@example.org (Clint Olsen) (2003-05-18)|
|Re: Constant expression evaluation? email@example.com (Niksa Orlic) (2003-05-29)|
|Re: Constant expression evaluation? firstname.lastname@example.org (david lindauer) (2003-05-29)|
|From:||david lindauer <email@example.com>|
|Date:||29 May 2003 03:24:44 -0400|
|Posted-Date:||29 May 2003 03:24:44 EDT|
Paul Davis wrote:
> I'm hoping to add constant expressions to a simple compiler I've
> written, but it looks like some of my early design decisions will make
> this difficult. I'd appreciate some ideas on better ways to do this.
My own compiler has a constant-expression evaluator... it just goes
through the intermediate parse-trees after the fact of generating them
and evaluates constant expressions before generating code. It works
well, but is kind of inefficient. A really cool thing I found out
from someone on this group is that if you generate say a three-address
intermediate code from the parse trees or whatever, and compile all
the variable references into a DAG tree, you can then evaluate
constant expressions on the fly as you are building the DAG tree.
Much more efficient than the present examination algorithm and gets me
local optimizations at the same time :).
Return to the
Search the comp.compilers archives again.