runtime

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	IP     int
	Vars   map[string]value.Value  // Local scope
	Fn     *value.ScriptFunction   // Hàm đang được thực thi
	Defers []*value.ScriptFunction // Deferred functions
}

Frame đại diện cho một khung thực thi (Activation Record)

type Runtime

type Runtime struct {
	Bytecode  []byte
	Constants []value.Value
	Stack     []value.Value
	Vars      map[string]value.Value // Module/Global scope
	Globals   map[string]value.Value // Engine Builtins
	Frames    []Frame                // Call Stack
	FrameIdx  int                    // Hiện tại đang ở Frame nào
	Energy    uint64                 // Năng lượng tiêu thụ
	Spawner   func(s *value.ScriptFunction)
}

func New

func New(code []byte, constants []value.Value) *Runtime

func (*Runtime) Defer

func (vm *Runtime) Defer(fn *value.ScriptFunction)

func (*Runtime) ExecuteLambda

func (vm *Runtime) ExecuteLambda(s *value.ScriptFunction, args []value.Value) value.Value

func (*Runtime) FastReset

func (vm *Runtime) FastReset(code []byte, constants []value.Value, globals map[string]value.Value)

func (*Runtime) Run

func (vm *Runtime) Run() value.Value

Jump to

Keyboard shortcuts

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