Documentation
¶
Overview ¶
Package opcodes defines plain data shapes for identifying an operation and its operands.
It performs no encoding and no execution and defines no domain-specific operations. Domain semantics belong to packages built on top: opruntime dispatches an Op to a Go function, and a domain package (such as a future ownership bytecode adapter) declares what each Op means.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instruction ¶
Instruction pairs an Op with three generic operand slots. The meaning of A, B, and C is defined entirely by whatever opruntime.Handler is registered for Op, not by this package.
type Op ¶
type Op uint8
Op identifies an operation. The zero value, OpNop, is always a safe no-op. Every other value is defined by the domain package that uses it.
const OpNop Op = 0
OpNop is the only predefined Op. It is the zero value of Op.
func (Op) String ¶
String returns "nop" for OpNop and "Op(N)" for any other value, since this package does not know the names domain packages give their own operations.
Example ¶
package main
import (
"fmt"
"github.com/apsis-io/velocity/opcodes"
)
func main() {
const opIncrement opcodes.Op = 1
fmt.Println(opcodes.OpNop)
fmt.Println(opIncrement)
}
Output: nop Op(1)