Version 4 (modified by cotto, 5 years ago)

add some of the simpler smalltalk operations

The VM for the Smalltalk interpreter Squeak has a design similar to our eventual goal for Parrot, namely that it has a small core of operations implemented in C with the rest of the language being implemented in terms of these operations. In hope of jumpstarting the design and implementation of Lorito (aka L1), this page lists the 42 operations used by Squeak's VM. The hope is that a similar set of operations can be used as Lorito ops.

Because most Parrot developers are not familiar with Smalltalk, so the following table lists the operations used to implement Squeak (available  here), example Smalltalk code, a description, their equivalent in C syntax and an appropriate name for the Lorito op. Many definitions were stolen from  here.

Memory access goes through a set of 6 macros for reading and writing single bytes, 4-byte words and 8-byte floats.

Squeak operation example Smalltalk codedescriptionequivalent C codeLorito op name
&
|
and:
or:
not
+ 5+5 addition a = 5 + 5 add
- 4-3 subtractiona = 4 - 3 sub
* 6*7 multiplicationa = 6 * 7 mul
// 15//5 division a = 15 / 5 div
\\ 7\\3 mod a = 7 % 3 mod
min:
max:
bitAnd :
bitOr:
bitXor:
bitShift:
< 5<3 less than a = 5 < 3 lt
<= 5<=3 less than or equala = 5 <= 3le
= 5=3 equality (deep)a = 5 == 3 eqd
> 5>3 greater thana = 5 > 3 gt
>= 5>=3 greater than or equala = 5 <= 3ge
~= 5=~3 inequality (deep) ned
== 5==5 equality (shallow)a = 5 == 5eqs
isNil
notNil
whileTrue:
whileFalse:
to:do:
to:by:do:
ifTrue:
ifFalse:
ifTrue:ifFalse:
ifFalse:ifTrue:
at:
at:put:
<<
>>
bitInvert32
preIncrement
integerValueOf:
integerObjectOf:
isIntegerObject: