Version 1 (modified by cotto, 12 years ago) |
---|
This page describes a current approximation of Lorito's ops. It is expected to converge with the eventual implementation as the number of edits increases.
Control Flow (5 ops)
- noop - do nothing
- call - call a sub (or an object method or vtable function)
- end - halt the interpreter cleanly
- goto - unconditional branch
- if - conditional branch
Math (14 ops)
- add_[in] - add two registers of the same type
- sub_[in] - subtract two registers
- mul_[in] - multiply two registers
- div_[in] - divide two registers
- mod_[in] - take the mod of a register
- and - bitwise and of an int
- or - bitwise or of an int
- not - bitwise not of an int
- xor - bitwise exclusive or of an int
Comparison (6 ops)
- iseq_[in] - compute equality between two registers of the same type
- isgt_[in] - a >= b
- isge_[in] - a > b
Values (12 ops)
- set_[ins]_[ins] - copy/coerce registers between primitive types
- load_const_[ins] - load a constant into a register
Objects (8 ops)
- box - turn an int, float or string into an object
- new - create a new object
- new_[insp] - create a new object with an argument
- getattr - retrieve an object attribute's value
- setattr - set an object attribute's value
Other (1 op)
- loadlib - load a (dll/so, pbc or HLL?) library
I/O (3 ops, bootstrapping only)
- read - read from stdin*
- write - write to stdout*
- gripe - write to stderr*
* read, write and gripe are only intended for use during Lorito's implementation phase. Once Lorito matures, these ops will become methods on a FileHandle.