vm

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 1 Imported by: 0

README

Virtual machine and bytecode

Bytecode and the virtual machine of the Gentee programming language are currently under development. The current version of the language executes scripts directly using the AST tree. It's not fast but it works.

Documentation

Index

Constants

View Source
const (
	STACKSIZE = 128
)

Variables

This section is empty.

Functions

func Run

func Run(exec *core.Exec, settings Settings) (interface{}, error)

Types

type Call

type Call struct {
	IsFunc bool
	Offset int32
	Int    int32
	Float  int32
	Str    int32
	Any    int32
}

Call stores stack of blocks

type Runtime

type Runtime struct {
	Owner    *VM
	ParCount int32
	Calls    []Call
	//	Consts
	// These are stacks for different types
	SInt   [STACKSIZE]int64       // int, char, bool
	SFloat [STACKSIZE]float64     // float
	SStr   [STACKSIZE]string      // str
	SAny   [STACKSIZE]interface{} // all other types
}

Runtime is the one thread structure

func (*Runtime) Run

func (rt *Runtime) Run(i int64) (result interface{}, err error)

type Settings

type Settings struct {
	CmdLine []string
}

type VM

type VM struct {
	Settings Settings
	Exec     *core.Exec
	Runtimes []*Runtime
}

VM is the main structure of the virtual machine

func (*VM) RunThread

func (vm *VM) RunThread(offset int64) (interface{}, error)

Jump to

Keyboard shortcuts

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