symbolTable

package
v0.0.0-...-c04ea6e Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding struct {
	IsVariable    bool
	CanBeShadowed bool
	// contains filtered or unexported fields
}

Binding reperents the location in memory of an identifier

func CreateBinding

func CreateBinding(locator locator.Locator, typing typing.Typing) *Binding

func CreateBindingCannotBeShadowed

func CreateBindingCannotBeShadowed(locator locator.Locator, typing typing.Typing) *Binding

func (*Binding) GetTyping

func (binding *Binding) GetTyping() typing.Typing

type Scope

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

Scope is where variables live and can be referenced

func CreateScope

func CreateScope(baseScope *Scope) *Scope

CreateScope with a baseScope. If nil, it will use itself as the base scope

func (*Scope) CreateBinding

func (scope *Scope) CreateBinding(identifier string, locator locator.Locator, typing typing.Typing) *Binding

func (*Scope) CreateBindingCannotBeShadowed

func (scope *Scope) CreateBindingCannotBeShadowed(identifier string, locator locator.Locator, typing typing.Typing) *Binding

CreateBindingCannotBeShadowed creates a binding associated with an identifier that cannot be shadowed in descendent scopes

func (*Scope) CreateSubScope

func (scope *Scope) CreateSubScope() *Scope

CreateSubScope using current scope as base scope

func (*Scope) FindBinding

func (scope *Scope) FindBinding(identifier string) *Binding

func (*Scope) GetScopeIdentifier

func (scope *Scope) GetScopeIdentifier() string

func (*Scope) VariableCanBeShadowed

func (scope *Scope) VariableCanBeShadowed(identifier string) bool

func (*Scope) VariableDeclared

func (scope *Scope) VariableDeclared(identifier string) bool

type SymbolTable

type SymbolTable map[string]*Binding

A SymbolTable is a mapping from an identifier to its binding

func (*SymbolTable) Install

func (symbolTable *SymbolTable) Install(identifier string, binding *Binding)

func (*SymbolTable) Lookup

func (symbolTable *SymbolTable) Lookup(identifier string) *Binding

Jump to

Keyboard shortcuts

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