op

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 0 Imported by: 30

Documentation

Overview

Package op defines opcodes used by the Risor compiler and virtual machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryOpType

type BinaryOpType uint16

BinaryOpType describes a type of binary operation.

const (
	Add BinaryOpType = iota + 1
	Subtract
	Multiply
	Divide
	Modulo
	And
	Or
	Xor
	Power
	LShift
	RShift
	BitwiseAnd
	BitwiseOr
)

type Code

type Code uint16

Code is an integer opcode that indicates an operation to execute.

const (
	Nop Code = iota
	BinaryOp
	BinarySubscr
	BuildList
	BuildMap
	BuildSet
	BuildString
	Call
	CompareOp
	ContainsOp
	Copy
	DeleteSubscr
	False
	ForIter
	GetIter
	Halt
	Import
	JumpBackward
	JumpForward
	Length
	LoadAttr
	LoadClosure
	LoadConst
	LoadFast
	LoadFree
	LoadGlobal
	LoadName
	MakeCell
	Nil
	Partial
	PopJumpBackwardIfFalse
	PopJumpBackwardIfTrue
	PopJumpForwardIfFalse
	PopJumpForwardIfTrue
	PopTop
	Print
	PushNil
	Range
	ReturnValue
	Slice
	StoreAttr
	StoreFast
	StoreFree
	StoreGlobal
	StoreName
	StoreSubscr
	Swap
	True
	UnaryInvert
	UnaryNegative
	UnaryNot
	UnaryPositive
	Unpack
)

type CompareOpType

type CompareOpType uint16

CompareOpType describes a type of comparison operation.

const (
	LessThan CompareOpType = iota + 1
	LessThanOrEqual
	Equal
	NotEqual
	GreaterThan
	GreaterThanOrEqual
)

type Info

type Info struct {
	Name         string
	OperandCount int
}

Info contains information about an opcode.

func GetInfo

func GetInfo(op Code) Info

GetInfo returns information about the given opcode.

Jump to

Keyboard shortcuts

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