[squeak-dev] Blue book, the stack and reverse polish notation--please confirm/disavow/ridicule my reasoning

Eliot Miranda eliot.miranda at gmail.com
Tue Nov 19 16:47:00 UTC 2013


Hi Timothy,


On Tue, Nov 19, 2013 at 8:33 AM, gettimothy <gettimothy at zoho.com> wrote:

> Part 4 of the Blue Book--chapter 26 The implementation--in the intro there
> is this example:
>
>
>
> center
>   ^ origin + corner / 2
>
>
>
> With these operations
>
>
> Rectangle center
>   0       push the value of the receiver's first instance variable
> (origin) onto the
>           stack
>    1       push the value of the receiver's second instance variable
> (corner) onto the
>           stack
>   176     send a binary message with the selector +
>   119     push the Smalllnteger 2 onto the stack
>   185     send a binary message with the selector /
>   124     return the object on top of the stack as the value of the
> message (center)
>
>
> In a Workspace, when I doit on 3 + 7/2 I get 5, left, right, unary,
> binary....rules apply.
>
> What I see here--and please check my reasoning--is a RPN that places
> things onto the stack via Smalltalk's order of operation rules and then
> does conventional RPN processing.
>
> In other words, Smalltalk expressions are translated to RPN and then
> placed on the stack.
>

Yes, and so they are in most stack-based implementations of languages.
 Bytecode for a stack machine is a form of RPN.

A simple 'banish the thought' or 'yep' or 'sometimes'  would be helpful as
> I move forward in my study.  I am just trying to avoid carrying forward an
> improper idea that I will have to revise later when/if the facts turn out
> otherwise.
>
> thx.
>
> t
>

-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131119/6044375f/attachment.htm


More information about the Squeak-dev mailing list