vm

package
v0.0.0-...-47fdfb9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExceptionClass = value.NewClass("Exception", constants.EXCEPTION_CLASS_ID)
View Source
var RuntimeErrorClass = value.NewClass("RuntimeError", constants.RUNTIME_ERROR_CLASS_ID)
View Source
var SyntaxErrorClass = value.NewClass("SyntaxError", constants.SYNTAX_ERROR_CLASS_ID)
View Source
var TypeErrorClass = value.NewClass("TypeError", constants.TYPE_ERROR_CLASS_ID)

Functions

func PrintChunk

func PrintChunk(c value.Chunk, internedStrings []string)

func PrintExceptionTable

func PrintExceptionTable(t value.ExceptionTable, index int, internedStrings []string)

func PrintFunc

func PrintFunc(f *value.Function, index int, internedStrings []string)

Types

type CallFrame

type CallFrame struct {
	*value.Function
	UpValues []value.UpValue
	// contains filtered or unexported fields
}

func NewCallFrame

func NewCallFrame(fn *value.Function, pc int, stackStart int) *CallFrame

type TableFunc

type TableFunc func(*VM, int)

type VM

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

func NewVM

func NewVM(fn *value.Function,
	internedStrings []string,
	stringConstMap map[string]int,
	debugInfo map[*value.Function]value.DebugInfo) *VM

func (*VM) DefineClass

func (v *VM) DefineClass(name string, c *value.Class)

func (*VM) DefineNative

func (v *VM) DefineNative(name string, fn *value.NativeFunction)

func (*VM) InvokeBlock

func (v *VM) InvokeBlock(fn interface{}, params []value.Value) value.Value

InvokeBlock, fn parameter is either *value.Function or *value.Closure

func (*VM) Panic

func (v *VM) Panic(m string)

func (*VM) Run

func (v *VM) Run()

type VMTable

type VMTable [opcode.OP_NOP + 1]TableFunc

Jump to

Keyboard shortcuts

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