View Source Signo.Env (Signo v0.0.1)

Struct holding all variable and function definitions in a certain scope.

Scopes can be nested. Whenever a variable is being looked up, the lookup will walk the scope-chain up until it finds a definition.

Summary

Types

@type scope() :: %{required(Signo.AST.ref()) => Signo.AST.value()}
@type t() :: %Signo.Env{parent: t() | nil, scope: scope()}

Functions

@spec assign(t(), Signo.AST.ref(), Signo.AST.value()) :: t()
@spec lookup!(nil, Signo.AST.ref(), Signo.Position.t()) :: no_return()
@spec lookup!(t(), Signo.AST.ref(), Signo.Position.t()) :: Signo.AST.value()
Link to this function

new(parent, definitions \\ [])

View Source
@spec new(t(), [{Signo.AST.ref(), Signo.AST.value()}]) :: t()