vm

package
v1.8.100 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpPush byte = iota
	OpPop
	OpRot
	OpFetch
	OpFetchMap
	OpTrue
	OpFalse
	OpNil
	OpNegate
	OpNot
	OpEqual
	OpEqualInt
	OpEqualString
	OpJump
	OpJumpIfTrue
	OpJumpIfFalse
	OpJumpBackward
	OpIn
	OpLess
	OpMore
	OpLessOrEqual
	OpMoreOrEqual
	OpAdd
	OpSubtract
	OpMultiply
	OpDivide
	OpModulo
	OpExponent
	OpRange
	OpMatches
	OpMatchesConst
	OpContains
	OpStartsWith
	OpEndsWith
	OpIndex
	OpSlice
	OpProperty
	OpCall
	OpCallFast
	OpMethod
	OpArray
	OpMap
	OpLen
	OpCast
	OpStore
	OpLoad
	OpInc
	OpBegin
	OpEnd // This opcode must be at the end of this list.
)

Variables

View Source
var (
	MemoryBudget int = 1e6
)

Functions

func FetchFn

func FetchFn(from interface{}, name string) reflect.Value

func Run

func Run(program *Program, env interface{}) (interface{}, error)

Types

type Call

type Call struct {
	Name string
	Size int
}

type Program

type Program struct {
	Source    *file.Source
	Locations map[int]file.Location
	Constants []interface{}
	Bytecode  []byte
}

func (*Program) Disassemble

func (program *Program) Disassemble() string

type Scope

type Scope map[string]interface{}

type VM

type VM struct {
	// contains filtered or unexported fields
}

func Debug

func Debug() *VM

func (*VM) Position

func (vm *VM) Position() chan int

func (*VM) Run

func (vm *VM) Run(program *Program, env interface{}) (out interface{}, err error)

func (*VM) Scope

func (vm *VM) Scope() Scope

func (*VM) Stack

func (vm *VM) Stack() []interface{}

func (*VM) Step

func (vm *VM) Step()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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