code

package
v0.0.0-...-62dc95f Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

The Monkey Language bytecode definition

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

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 (
	OpNull Opcode = iota

	OpConstant

	OpPop

	OpJump
	OpJumpNotTruthy

	OpTrue
	OpFalse

	OpBang
	OpMinus

	OpAdd
	OpSub
	OpMul
	OpDiv

	OpEqual
	OpNotEqual
	OpLessThan
	OpGreaterThan

	OpGetGlobal
	OpSetGlobal

	OpIndex
	OpArray
	OpHash
)

Jump to

Keyboard shortcuts

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