Version 4 (modified by cotto, 4 years ago) |
---|

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 code | description | equivalent C code | Lorito op name |

& | ||||

| | ||||

and: | ||||

or: | ||||

not | ||||

+ | 5+5 | addition | a = 5 + 5 | add |

- | 4-3 | subtraction | a = 4 - 3 | sub |

* | 6*7 | multiplication | a = 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 equal | a = 5 <= 3 | le |

= | 5=3 | equality (deep) | a = 5 == 3 | eqd |

> | 5>3 | greater than | a = 5 > 3 | gt |

>= | 5>=3 | greater than or equal | a = 5 <= 3 | ge |

~= | 5=~3 | inequality (deep) | ned | |

== | 5==5 | equality (shallow) | a = 5 == 5 | eqs |

isNil | ||||

notNil | ||||

whileTrue: | ||||

whileFalse: | ||||

to:do: | ||||

to:by:do: | ||||

ifTrue: | ||||

ifFalse: | ||||

ifTrue:ifFalse: | ||||

ifFalse:ifTrue: | ||||

at: | ||||

at:put: | ||||

<< | ||||

>> | ||||

bitInvert32 | ||||

preIncrement | ||||

integerValueOf: | ||||

integerObjectOf: | ||||

isIntegerObject: |