compiler

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterLib added in v0.0.2

func RegisterLib(name string, loader func() *object.Scope)

Types

type Bytecode

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

type CompilationScope

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

type Compiler

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

func New

func New() *Compiler

func NewWithState

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

func (*Compiler) Bytecode

func (c *Compiler) Bytecode() *Bytecode

func (*Compiler) Compile

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

func (*Compiler) SearchPlugin added in v0.0.6

func (c *Compiler) SearchPlugin(m string) *string

func (*Compiler) SearchSource added in v0.0.6

func (c *Compiler) SearchSource(m string) *string

type EmittedInstruction

type EmittedInstruction struct {
	Opcode   code.Opcode
	Position int
}

type Symbol

type Symbol struct {
	Name  string
	Scope SymbolScope
	Index int
}

type SymbolScope

type SymbolScope string
const (
	GlobalScope  SymbolScope = "Global"
	LocalScope   SymbolScope = "Local"
	BuiltinScope SymbolScope = "Builtin"
	FreeScope    SymbolScope = "Free"
)

type SymbolTable

type SymbolTable struct {
	Outer *SymbolTable

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

func NewEnclosedSymbolTable

func NewEnclosedSymbolTable(outer *SymbolTable) *SymbolTable

func NewSymbolTable

func NewSymbolTable() *SymbolTable

func (*SymbolTable) Define

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

func (*SymbolTable) DefineBuiltin

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

func (*SymbolTable) Resolve

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

Jump to

Keyboard shortcuts

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