[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Aug 30 16:41:53 1999 
Subject:Re: Stack manipulation syntax (WAS: A primeval C compiler) 
From: Robin Popplestone  
Volume-ID:990830.01 

richard@starburst.demon.co.uk (Richard Wendland) wrote:

>> POP-2 had an explicit evaluation stack, but rvalues weren't stacked as
>> I recall - perhaps the reason for the assignment operator for each rvalue.

To which Aaron Sloman replied:

>I don't know what you mean by stacking rvalues. See the comment on
>multiple assignment below.

Richard was thinking of something closer to a model of computation in
which addresses are "first class citizens" which they weren't in POP-2.
Though in that case, shouldn't it be lvalues that are stacked, since a
rvalue is derived from an lvalue by dereferencing? With that model, 

   x, y -> x -> y;

might be rendered in C as

   push(&x); deref(); push(&y); deref(); 
   push(&x); uderef(); push(&y); uderef();

   void push(Object * x) {(++sp) = x};
   void deref(){ *sp = *(*sp); return;}
   void uderef() { Object tos = *(sp--); *tos = *(sp--); return;}

But in fact, POP-2 did something more like

	push(x); push(y); pop(x); pop(y);



(no pun intended.)