Documentation ¶
Index ¶
Constants ¶
View Source
const ( OperandWidth1 OperandWidth2 )
OperandWidth is the number of bytes an operand takes up
Variables ¶
This section is empty.
Functions ¶
func ReadOperands ¶
func ReadOperands(def *Definition, ins []byte) (operandsRead []int, n uint)
ReadOperands reverses a bytecode instruction and reads its operands. Returning the operands in the instruction and n number of bytes read.
func ReadUint16 ¶
func ReadUint16(ins Instructions) uint16
func ReadUint8 ¶
func ReadUint8(ins Instructions) uint8
Types ¶
type Definition ¶
type Definition struct { // Name of Opcode Name string // OperandWidths contains the OperandWidth for each operand OperandWidths []uint }
Definition helps make an Opcode readable
func Lookup ¶
func Lookup(op Opcode) (*Definition, error)
type Instructions ¶
type Instructions []byte
func (Instructions) String ¶
func (ins Instructions) String() string
type Opcode ¶
type Opcode byte
const ( OpConstant Opcode = iota OpPop OpAdd OpSub OpMul OpDiv OpTrue OpFalse OpEqual OpNotEqual OpGreaterThan OpBang OpMinus OpJump OpJumpNotTruthy OpNull OpGetGlobal OpSetGlobal OpArray OpHash OpIndex OpCall OpReturn OpReturnValue OpGetLocal OpSetLocal OpGetBuiltin OpClosure OpGetFree OpCurrentClosure )
Click to show internal directories.
Click to hide internal directories.