monkey-lang: Index | Files

package vm

import ""


Package Files

frame.go vm.go


const (
    StackSize  = 2048
    MaxFrames  = 1024
    MaxGlobals = 65536


var (
    True  = &object.Boolean{Value: true}
    False = &object.Boolean{Value: false}
    Null  = &object.Null{}

func ExecModule Uses

func ExecModule(name string, state *VMState) (object.Object, error)

ExecModule compiles the named module and returns a *object.Module object

type Frame Uses

type Frame struct {
    // contains filtered or unexported fields

func NewFrame Uses

func NewFrame(cl *object.Closure, basePointer int) *Frame

func (*Frame) Instructions Uses

func (f *Frame) Instructions() code.Instructions

func (*Frame) NextOp Uses

func (f *Frame) NextOp() code.Opcode

NextOp ...

type VM Uses

type VM struct {
    Debug bool
    // contains filtered or unexported fields

func New Uses

func New(bytecode *compiler.Bytecode) *VM

func NewWithState Uses

func NewWithState(bytecode *compiler.Bytecode, state *VMState) *VM

func (*VM) LastPopped Uses

func (vm *VM) LastPopped() object.Object

func (*VM) Run Uses

func (vm *VM) Run() error

type VMState Uses

type VMState struct {
    Constants []object.Object
    Globals   []object.Object
    Symbols   *compiler.SymbolTable

func NewVMState Uses

func NewVMState() *VMState

func (*VMState) ExportedHash Uses

func (s *VMState) ExportedHash() *object.Hash

ExportedHash returns a new Hash with the names and values of every publically exported binding in the vm state. That is every binding that starts with a capital letter. This is used by the module import system to wrap up the compiled and evaulated module into an object.

Package vm imports 12 packages (graph) and is imported by 1 packages. Updated 2019-04-03. Refresh now. Tools for package owners.