|multiple assignment email@example.com (Michael Larson) (2000-02-28)|
|Re: multiple assignment Jens_Kilian@agilent.com (Jens Kilian) (2000-03-06)|
|Re: multiple assignment firstname.lastname@example.org (2000-03-06)|
|Re: multiple assignment email@example.com (2000-03-06)|
|Date:||6 Mar 2000 01:07:07 -0500|
|Organization:||Deja.com - Before you buy.|
> I have a testbed compiler for a simple C dialect (Renderman Shading
> Language). One of the problems I am having with evaluating the parse
> tree is with multiple assignement. It should be clean but it really is
> a hack for a recusive evaluator.
> a = b = c + 1
> pop b
> push b
You should implement a 'store' bytecode. Simple single assignments
would be compiled as 'store b' + 'pop top' (pop top is generated
by the semicolon) and then peephole-optimized to 'pop b'. If your
hack works for horrible C hacks as
foo(a = b);
you can modify it to be a kind of 'in-place' peephole optimization.
So it would lose its hack status and become an elegant solution...
Return to the
Search the comp.compilers archives again.