Module CPP.ICode.Parser.SQL.Symboltab

This module defines a Symboltable optimized for the SQLNamer. It contains two Maps, both using strings as keys and < as comparison operation. It is parameterized over both value types. Only the first Map is supporting a scope concept.

Summary of exported operations:

emptyTable :: Symboltable a b  Deterministic 
lookupFirstTable :: String -> Symboltable a b -> Maybe a  Deterministic 
Lookupfunction: First looks up the key in the current scope (first table) if it is not found the surrounding scope will be used and so on.
lookupCurrentScope :: String -> Symboltable a b -> Maybe a  Deterministic 
Looks up the key just in the current scope of the first table.
lookupSecondTable :: String -> Symboltable a b -> Maybe b  Deterministic 
Looks up the key in the second table (which does not support scopes).
insertFirstTable :: String -> a -> Symboltable a b -> Symboltable a b  Deterministic 
Inserts a key-value-pair into the current scope (first table).
insertDefFirstTab :: String -> a -> (a -> a -> a) -> Symboltable a b -> Symboltable a b  Deterministic 
Inserts a key-value-pair into the current scope (first table) without throwing away previous bindings.
insertSecondTable :: String -> a -> Symboltable b a -> Symboltable b a  Deterministic 
Inserts a key-value-pair into the second table (which does not support scopes).
enterScope :: Symboltable a b -> Symboltable a b  Deterministic 
Create a new scope inside the last one (first table, leaving the secong one unchanged).
exitScope :: Symboltable a b -> Symboltable a b  Deterministic 
Exits current scope, so that the surrounding one will be used.
combineST :: Symboltable a b -> Symboltable a b -> Symboltable a b  Deterministic 
Combines two Symboltables.

Exported datatypes:


Symboltable

A Symboltable consists of at least one pair of Maps. There can be another table representing a surrounding scope.

Constructors:


Exported operations:

emptyTable :: Symboltable a b  Deterministic 

Further infos:
  • solution complete, i.e., able to compute all solutions

lookupFirstTable :: String -> Symboltable a b -> Maybe a  Deterministic 

Lookupfunction: First looks up the key in the current scope (first table) if it is not found the surrounding scope will be used and so on. Returns Nothing if no value was found.

lookupCurrentScope :: String -> Symboltable a b -> Maybe a  Deterministic 

Looks up the key just in the current scope of the first table.

lookupSecondTable :: String -> Symboltable a b -> Maybe b  Deterministic 

Looks up the key in the second table (which does not support scopes).

insertFirstTable :: String -> a -> Symboltable a b -> Symboltable a b  Deterministic 

Inserts a key-value-pair into the current scope (first table).

insertDefFirstTab :: String -> a -> (a -> a -> a) -> Symboltable a b -> Symboltable a b  Deterministic 

Inserts a key-value-pair into the current scope (first table) without throwing away previous bindings. Values are combined by given combinator.

insertSecondTable :: String -> a -> Symboltable b a -> Symboltable b a  Deterministic 

Inserts a key-value-pair into the second table (which does not support scopes).

enterScope :: Symboltable a b -> Symboltable a b  Deterministic 

Create a new scope inside the last one (first table, leaving the secong one unchanged).

Further infos:
  • solution complete, i.e., able to compute all solutions

exitScope :: Symboltable a b -> Symboltable a b  Deterministic 

Exits current scope, so that the surrounding one will be used. If the current scope is the most general one, nothing will be changed.

Further infos:
  • solution complete, i.e., able to compute all solutions

combineST :: Symboltable a b -> Symboltable a b -> Symboltable a b  Deterministic 

Combines two Symboltables. The current Scopes will be merged, all the remaining scopes are taken from the first table. Bindings for the same key will be overwritten by the binding in the current scope.