stgi-1.0.1: Educational implementation of the STG (Spineless Tagless G-machine)

Safe HaskellNone
LanguageHaskell2010

Stg.Machine.Env

Contents

Description

Defines operations on local and global variable environments.

Synopsis

Locals

addLocals :: [Mapping Var Value] -> Locals -> Locals Source

Add a list of bindings to the local environment.

Already existing variables will be shadowed (i.e. overwritten).

makeLocals :: [Mapping Var Value] -> Locals Source

Create a local environment from a list of bindings.

val :: Locals -> Globals -> Atom -> Validate NotInScope Value Source

Look up the value of an Atom first in the local, then in the global environment.

vals :: Locals -> Globals -> [Atom] -> Validate NotInScope [Value] Source

Look up the values of many Atoms, and return their values in the input's order, or a list of variables not in scope.

localVal :: Locals -> Atom -> Validate NotInScope Value Source

Look up the value of a variable in the local environment.

Globals

globalVal :: Globals -> Atom -> Validate NotInScope Value Source

Look up the value of a variable in the global environment.