code

package
v1.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Make

func Make(op Opcode, operands ...int) []byte

func ReadOperands

func ReadOperands(def *Definition, ins Instructions) ([]int, int)

func ReadUint16

func ReadUint16(ins Instructions) uint16

func ReadUint8

func ReadUint8(ins Instructions) uint8

Types

type Definition

type Definition struct {
	Name          string
	OperandWidths []int
}

func Lookup

func Lookup(op byte) (*Definition, error)

type Instructions

type Instructions []byte

func (Instructions) String

func (ins Instructions) String() string

type Opcode

type Opcode byte
const (
	LoadConstant Opcode = iota
	LoadBuiltin
	// AssignGlobal ...
	AssignGlobal
	// AssignLocal ...
	AssignLocal
	LoadGlobal
	BindGlobal
	LoadLocal
	BindLocal
	LoadFree
	LoadModule
	SetSelf
	LoadTrue
	LoadFalse
	LoadNull
	GetItem
	SetItem
	MakeArray
	MakeHash
	MakeClosure
	Pop
	// Noop ...
	Noop
	Add
	Sub
	Mul
	Div
	Mod
	Or
	And
	Not
	BitwiseOR
	BitwiseXOR
	BitwiseAND
	BitwiseNOT
	LeftShift
	RightShift
	Equal
	NotEqual
	GreaterThan
	// GreaterThanEqual ...
	GreaterThanEqual
	Minus
	JumpIfFalse
	Jump
	Call
	Return
	ReturnValue
)

func (Opcode) String

func (o Opcode) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL