base

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Weblang VM environment base struct types such as Function, MmemoryMap, Class and Object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class struct {
	Type     string              // Class type (string representation)
	Methods  map[string]Function // Function list
	ByteCode *bytecode.ByteCode  // Bytecode pointer
}

Weblang class represantation in VM

type Function

type Function struct {
	Args        map[string]interface{} // arguments list
	Handler     FunctionHandler        // FunctionHandler interface for function invoke
	ClassMethod *method.ClassMethod    // ClassMethod struct from bytecode file
}

Web function representation in VM

type FunctionHandler added in v0.2.2

type FunctionHandler interface {
	Invoke(args map[string]interface{}, funcPtr *Function, callerObj *Object, receiverObj *Object) error // Invoke function execution
}

User defined function handler

type MemoryMap added in v0.4.1

type MemoryMap struct {
	Classes map[string]*Class  // Class list
	Objects map[string]*Object // All objects list
}

Memory of all declared classes in VM

type Object added in v0.3.0

type Object struct {
	Scope          uint                   // Object scope, 0 - global, 1 and larger - local
	Class          *Class                 // pointer to class struct
	Attributes     map[string]interface{} // Attributes list
	AttributesType map[string]uint8       // Attributes type list
	Memory         *MemoryMap             // list of all declared global classes & objects in VM environment
}

Object struct in VM environment

Jump to

Keyboard shortcuts

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