Version 6 (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, method or vtable function
- end - halt the interpreter cleanly
- goto - unconditional branch
- if - conditional branch
Value (12 ops)
The Value, Math, Comparison and Object ops are designed to minimize op proliferation. Apart from type coercion via coerce_[ins]_[ins], all ops require that each of their arguments be of the same type.
- coerce_[ins]_[ins] - coerce registers between primitive types (objects will provide the same functionality via vtable functions)
- load_const_[ins] - load a constant into a register
- set_[ins] - copy the contents of one register into another of the same type
Math (14 ops)
- add_[in] - add two registers of the same type
- sub_[in] - subtract two registers of the same type
- mul_[in] - multiply two registers of the same type
- div_[in] - divide two registers of the same type
- mod_[in] - return the remainder of $2/$3
- 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
Objects (5 ops)
- new - create a new object
- new_[ip] - create a new object with an initializer
- get_attr - retrieve an object attribute's value
- set_attr - set an object attribute's value
Other (1 op)
- loadlib - load a (dll/so, pbc or HLL?) library
I/O (4 ops, bootstrapping only)
These four ops are only intended for use during Lorito's implementation phase. Once Lorito matures to the point where we have a fixed set of ops and have tools that can generate Lorito, we expect these ops to become methods on a FileHandle.
- read - read from stdin
- write - write to stdout
- say - write to stdout and append a newline
- gripe - write to stderr