LobsterLang-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Scope

Synopsis

Documentation

data ScopeMb Source #

Structure representing a member in a scope. Can be a ScopeBegin to mark the beginning of a scope or a Variable containing its name as a Ast and its value as an Ast

Instances

Instances details
Show ScopeMb Source # 
Instance details

Defined in Scope

Eq ScopeMb Source # 
Instance details

Defined in Scope

Methods

(==) :: ScopeMb -> ScopeMb -> Bool #

(/=) :: ScopeMb -> ScopeMb -> Bool #

beginScope :: [ScopeMb] -> [ScopeMb] Source #

Begin a new scope by adding a ScopeBegin to the stack.

clearScope :: [ScopeMb] -> [ScopeMb] Source #

Clear the current scope

addVarToScope :: [ScopeMb] -> String -> Ast -> [ScopeMb] Source #

Add a Variable to the stack with its name as a Ast and its value by an Ast

getVarInScope :: [ScopeMb] -> String -> Maybe Ast Source #

Get the value contained in the variable given by name as a Ast, return Nothing if the variable don't exist or Just its value

addVarsToScope :: [ScopeMb] -> [String] -> [Ast] -> [ScopeMb] Source #

Add multiple variables to the stack with their names as a Ast and their values as an Ast

updateVar :: [ScopeMb] -> String -> Ast -> [ScopeMb] Source #

Update the given variable, don't do anything if it doesn't exist