[OT] Writing a parser for BASIC in Smalltalk/Squeak ? (<CSOTD> included)

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Wed Jan 9 17:37:43 UTC 2002


On Sat, 5 Jan 2002 danielv at netvision.net.il wrote:

> Haha, that's nice...

Indeed. I wonder if this behaviour is actually defined somewhere? It's at 
least counter-intuitive.

-- Bert


> Newbie that are left wondering might want to do browse the method,
> choose "show bytecodes" from the menu, and trace that mentally.
> 
> Actually, might be really nice to have a "low level debugger" showing
> the actual stack, and details of the context - the pc, the stackp and so
> forth. Could be a great start for someone curious about the workings of
> the VM.
> 
> Opening a debugger, inspecting the thisContext from the temp variables
> pane, and choosing 'all variables' while stepping through the method,
> with a browser open on 'show bytecodes' of the method gives an idea of
> what I mean...
> 
> Daniel
> 
> goran.hultgren at bluefish.se wrote:
> > <CSOTD>"This one actually is borrowed from Leandro Caniglia. He
> > challenged me yesterday
> > to figure out why the method SmallInteger>>gcd: actually works. The
> > challenge can also be expressed
> > like this: Evaluate this code below and figure out why n=5.
> > One could ask oneself if the assignment (m _ n) is performed after or
> > before the
> > evaluation of the expression?
> > If it is done before - then n should become 4 right? (2 + 2)
> > And if it is done after then it should become 6... (3 + 3)
> > Gurus: don't spoil it for the newbies ok? Let them chew on it for a
> > while... :-)"
> > | m n |
> > n _ 2.
> > m _ 3.
> > n _ m + (m _ n)
> > </CSOTD>
> 
> 





More information about the Squeak-dev mailing list