activations

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ValueType added in v0.14.0

type ValueType generic.Type

type ValueTypeActivation added in v0.14.0

type ValueTypeActivation struct {
	Depth  int
	Parent *ValueTypeActivation
	// contains filtered or unexported fields
}

A ValueTypeActivation is a map of strings to values. It can be used to represent an active scope in a program, i.e. it can be used as a symbol table during semantic analysis, or as an activation record during interpretation or compilation.

func NewValueTypeActivation added in v0.14.0

func NewValueTypeActivation(memoryGauge common.MemoryGauge, parent *ValueTypeActivation) *ValueTypeActivation

func (*ValueTypeActivation) Find added in v0.14.0

func (a *ValueTypeActivation) Find(name string) ValueType

Find returns the value for a given name in the activation. It returns nil if no value is found.

func (*ValueTypeActivation) FunctionValues added in v0.24.0

func (a *ValueTypeActivation) FunctionValues() map[string]ValueType

FunctionValues returns all values in the current function activation.

func (*ValueTypeActivation) Set added in v0.14.0

func (a *ValueTypeActivation) Set(name string, value ValueType)

Set sets the given name-value pair in the activation.

type ValueTypeActivations added in v0.14.0

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

ValueTypeActivations is a stack of activation records. Each entry represents a new activation record.

The current / most nested activation record can be found at the top of the stack (see function `Current`).

func NewValueTypeActivations added in v0.24.0

func NewValueTypeActivations(memoryGauge common.MemoryGauge) *ValueTypeActivations

func (*ValueTypeActivations) Current added in v0.14.0

Current returns the current / most nested activation, which can be found at the top of the stack. It returns nil if there is no active activation.

func (*ValueTypeActivations) CurrentOrNew added in v0.14.0

func (a *ValueTypeActivations) CurrentOrNew() *ValueTypeActivation

CurrentOrNew returns the current activation, or if it does not exist, a new activation

func (*ValueTypeActivations) Depth added in v0.14.0

func (a *ValueTypeActivations) Depth() int

Depth returns the depth (size) of the activation stack.

func (*ValueTypeActivations) Find added in v0.14.0

func (a *ValueTypeActivations) Find(name string) ValueType

Find returns the value for a given key in the current activation. It returns nil if no value is found or if there is no current activation.

func (*ValueTypeActivations) Pop added in v0.14.0

func (a *ValueTypeActivations) Pop()

Pop pops the top-most (current) activation from the top of the activation stack.

func (*ValueTypeActivations) Push added in v0.14.0

func (a *ValueTypeActivations) Push(activation *ValueTypeActivation)

Push pushes the given activation onto the top of the activation stack.

func (*ValueTypeActivations) PushNewWithCurrent added in v0.14.0

func (a *ValueTypeActivations) PushNewWithCurrent()

PushNewWithCurrent pushes a new empty activation to the top of the activation stack. The new activation has the current activation as its parent.

func (*ValueTypeActivations) PushNewWithParent added in v0.14.0

func (a *ValueTypeActivations) PushNewWithParent(parent *ValueTypeActivation) *ValueTypeActivation

PushNewWithParent pushes a new empty activation to the top of the activation stack. The new activation has the given parent as its parent.

func (*ValueTypeActivations) Set added in v0.14.0

func (a *ValueTypeActivations) Set(name string, value ValueType)

Set sets the name-value pair in the current scope.

Jump to

Keyboard shortcuts

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