vm

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 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
	OpMethod
	OpArray
	OpMap
	OpLen
	OpCast
	OpStore
	OpLoad
	OpInc
	OpBegin
	OpEnd
)

Variables

This section is empty.

Functions

func Run

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

Types

type Call

type Call struct {
	Name string
	Size int
}

type Program

type Program struct {
	Source    *file.Source
	Locations []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 NewVM

func NewVM(debug bool) *VM

func (*VM) Position

func (vm *VM) Position() chan int

func (*VM) Run

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

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