compiler

package
v0.0.0-...-55ade89 Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

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 (
	LocalScope   SymbolScope = "LOCAL"
	GlobalScope  SymbolScope = "GLOBAL"
	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