code

package
v0.0.0-...-161ba2d Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeInstruction

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

func ReadOperands

func ReadOperands(operation *Operation, instructionBytes []byte) ([]int, int)

Types

type Instructions

type Instructions []byte

func (Instructions) String

func (instructions Instructions) String() string

type Opcode

type Opcode byte
const (
	OpConstant Opcode = iota

	OpAdd
	OpSub
	OpMul
	OpDiv

	OpTrue
	OpFalse

	OpEqual
	OpNotEqual
	OpGreaterThan
	OpAnd
	OpOr

	OpMinus
	OpBang

	OpPop

	OpGotoNotTruthy // goto only if value on top of the stack is not truthy
	OpGoto

	OpNull

	OpGetGlobal
	OpSetGlobal

	OpGetLocal
	OpSetLocal

	OpGetStdlib

	OpArray
	OpHashMap

	OpIndex

	OpCall

	OpReturnValue
	OpReturn
)

type Operation

type Operation struct {
	Name          string
	OperandWidths []int
}

func LookupOperation

func LookupOperation(opcode byte) (*Operation, error)

Jump to

Keyboard shortcuts

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