Documentation
¶
Overview ¶
Package vm provides virtual machine implementation
Index ¶
Constants ¶
View Source
const ( // ErrBadInstruction is raised when the VM encounters an Opcode that has // not been properly mapped ErrBadInstruction = "unknown instruction encountered: %s" // ErrEmptyArgStack is raised when the VM encounters an instruction to pop // the argument stack, but the head of the stack is empty ErrEmptyArgStack = "attempt to pop empty argument stack" // ErrUnexpectedLabel is raised when the VM encounters a label that should // have otherwise been stripped when the instructions were made Runnable ErrUnexpectedLabel = "unexpected label encountered: %d" // ErrUnexpectedNoOp is raised when the VM encounters a NoOp instruction // that should have been stripped when the instructions were made Runnable ErrUnexpectedNoOp = "unexpected no-op encountered" )
Error messages
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
func NewAllocator ¶
func NewAllocator() *Allocator
type Closure ¶
type Closure struct {
*Procedure
// contains filtered or unexported fields
}
func (*Closure) CheckArity ¶
CheckArity performs a compile-time arity check for the Closure
type Procedure ¶
type Procedure struct {
ArityChecker data.ArityChecker
isa.Runnable
// contains filtered or unexported fields
}
Procedure encapsulates the initial environment of an abstract machine
func MakeProcedure ¶
func MakeProcedure(run *isa.Runnable, arity data.ArityChecker) *Procedure
func (*Procedure) Call ¶
Call allows an abstract machine Procedure to be called to instantiate a Closure. Only the compiler invokes this calling interface.
func (*Procedure) CheckArity ¶
CheckArity performs a compile-time arity check for the Procedure
Click to show internal directories.
Click to hide internal directories.