tlvm

package module
v0.0.0-...-d838209 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 10 Imported by: 0

README

tlvm

Tiny stack based VM and lisp like language compiler for it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompileOption

type CompileOption func(bt *VMByteCode)

func EnableDebugSymbols

func EnableDebugSymbols() CompileOption

func EnvVariables

func EnvVariables(env ...string) CompileOption

func ExtFunctions

func ExtFunctions(funcs map[string]any) (CompileOption, error)

func ExtFunctionsOrPanic

func ExtFunctionsOrPanic(funcs map[string]any) CompileOption

type SExpressions

type SExpressions []any

func Read

func Read(sourceCode string) (SExpressions, error)

type VM

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

func Build

func Build(text string, options ...CompileOption) (*VM, error)

func NewVM

func NewVM(output *VMByteCode) *VM

func (*VM) CodeString

func (v *VM) CodeString() string

func (*VM) Copy

func (v *VM) Copy() VM

func (*VM) Env

func (vm *VM) Env(k any, v any)

func (*VM) EnvFloat32

func (vm *VM) EnvFloat32(k string, v float32)

func (*VM) EnvFloat64

func (vm *VM) EnvFloat64(k string, v float64)

func (*VM) EnvInt

func (vm *VM) EnvInt(k string, v int)

func (*VM) EnvInt64

func (vm *VM) EnvInt64(k string, v int64)

func (*VM) EnvString

func (vm *VM) EnvString(k string, v string)

func (*VM) Execute

func (v *VM) Execute() (errRes error)

func (*VM) Reset

func (v *VM) Reset()

func (*VM) Result

func (v *VM) Result() any

type VMByteCode

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

func Compile

func Compile(text string, options ...CompileOption) (_ *VMByteCode, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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