vm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Abstract

type Abstract struct {
}

func (Abstract) InstructionString

func (a Abstract) InstructionString() string

type Application

type Application struct {
	Left  Value
	Right Value
}

func (Application) ValueString

func (a Application) ValueString() string

type Apply

type Apply struct {
}

func (Apply) InstructionString

func (a Apply) InstructionString() string

type Call

type Call struct {
	Code []Instruction
}

func (Call) InstructionString

func (c Call) InstructionString() string

type Callure

type Callure struct {
	Env  Environment
	Code []Instruction //left, right, Apply, Return
}

func (Callure) ValueString

func (c Callure) ValueString() string

type Close

type Close struct {
	Arg  string
	Code []Instruction
}

func (Close) InstructionString

func (c Close) InstructionString() string

type Closure

type Closure struct {
	Arg  string
	Env  Environment
	Code []Instruction //code, Return
}

func (Closure) ValueString

func (c Closure) ValueString() string

type Dump

type Dump struct {
	Env  Environment
	Code []Instruction
}

func (Dump) ValueString

func (d Dump) ValueString() string

type Environment

type Environment map[string]Value

type Fetch

type Fetch struct {
	Name string
}

func (Fetch) InstructionString

func (f Fetch) InstructionString() string

type Function

type Function struct {
	Arg  string
	Body Value
}

func (Function) ValueString

func (f Function) ValueString() string

type Instruction

type Instruction interface {
	InstructionString() string
}

func Compile

func Compile(expr ast.Expression) []Instruction

type Return

type Return struct {
}

func (Return) InstructionString

func (r Return) InstructionString() string

type Swap

type Swap struct {
}

func (Swap) InstructionString

func (w Swap) InstructionString() string

type Symbol

type Symbol struct {
	Name string
}

func (Symbol) ValueString

func (s Symbol) ValueString() string

type VM

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

func NewVM

func NewVM(code []Instruction) *VM

func (*VM) Run

func (vm *VM) Run() Value

type Value

type Value interface {
	ValueString() string
}

value is stack element

Jump to

Keyboard shortcuts

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