monkey-lang: github.com/prologic/monkey-lang/compiler Index | Files

package compiler

import "github.com/prologic/monkey-lang/compiler"

Index

Package Files

compiler.go symbol_table.go

type Bytecode Uses

type Bytecode struct {
    Instructions code.Instructions
    Constants    []object.Object
}

type Compiler Uses

type Compiler struct {
    Debug bool
    // contains filtered or unexported fields
}

func New Uses

func New() *Compiler

func NewWithState Uses

func NewWithState(symbolTable *SymbolTable, constants []object.Object) *Compiler

func (*Compiler) Bytecode Uses

func (c *Compiler) Bytecode() *Bytecode

func (*Compiler) Compile Uses

func (c *Compiler) Compile(node ast.Node) error

type EmittedInstruction Uses

type EmittedInstruction struct {
    Opcode   code.Opcode
    Position int
}

type Scope Uses

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

type Symbol Uses

type Symbol struct {
    Name  string
    Scope SymbolScope
    Index int
}

type SymbolScope Uses

type SymbolScope string
const (
    BuiltinScope SymbolScope = "BUILTIN"
    GlobalScope  SymbolScope = "GLOBAL"
    LocalScope   SymbolScope = "LOCAL"
    FreeScope    SymbolScope = "FREE"
)

type SymbolTable Uses

type SymbolTable struct {
    Outer *SymbolTable

    Store map[string]Symbol

    FreeSymbols []Symbol
    // contains filtered or unexported fields
}

func NewEnclosedSymbolTable Uses

func NewEnclosedSymbolTable(outer *SymbolTable) *SymbolTable

func NewSymbolTable Uses

func NewSymbolTable() *SymbolTable

func (*SymbolTable) Define Uses

func (s *SymbolTable) Define(name string) Symbol

func (*SymbolTable) DefineBuiltin Uses

func (s *SymbolTable) DefineBuiltin(index int, name string) Symbol

func (*SymbolTable) DefineFree Uses

func (s *SymbolTable) DefineFree(original Symbol) Symbol

func (*SymbolTable) Resolve Uses

func (s *SymbolTable) Resolve(name string) (Symbol, bool)

Package compiler imports 8 packages (graph) and is imported by 3 packages. Updated 2019-04-03. Refresh now. Tools for package owners.