| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Sutori.SymTable
Description
This module defines all the interaction with the table, along with the symbols themselves, their different categories and payloads.
- class SutSymbol a where
- data SutSymbol'
- class SutSymbol a => ASTSymbol a where
- class SutSymbol a => OffsetSymbol a where
- class SutSymbol a => ParametricSymbol a where
- type Scope = Int
- data SutParam = SutParam {}
- data SymFunction = SymFunction SutID SutTypeID [SutParam] SutAST (Maybe SutAST)
- data SymModule = SymModule SutID SutAST
- data SymPerson = SymPerson SutID Scope
- type SymTable = Map SutID [SutSymbol']
- data SymType = SymType SutID Scope SutTypeID
- data SymVariable = SymVariable SutID Scope SutTypeID Offset
- data SymbolCat
- class SutSymbol a => TypedSymbol a where
- insertSymbol :: SutSymbol' -> SymTable -> SymTable
- lookupSymbols :: SutID -> SymTable -> Maybe [SutSymbol']
- lookupSymbolsVariable :: SutID -> SymTable -> [SymVariable]
- lookupSymbolsPerson :: SutID -> SymTable -> [SymPerson]
- lookupSymbolsModule :: SutID -> SymTable -> [SymModule]
- lookupSymbolsType :: SutID -> SymTable -> [SymType]
- lookupSymbolsFunction :: SutID -> SymTable -> [SymFunction]
- updateSymbol :: SutSymbol' -> SymTable -> SymTable
- paramByValue :: SutTypeID -> SutID -> SutParam
- paramByRef :: SutTypeID -> SutID -> SutParam
- lookupAllFunctions :: Scope -> SymTable -> [SymFunction]
Documentation
class SutSymbol a where Source #
Represents a basic symbol
data SutSymbol' Source #
Boxed SutSymbols for the table to handle
Constructors
| SymModule' SymModule | |
| SymFunction' SymFunction | |
| SymPerson' SymPerson | |
| SymVariable' SymVariable | |
| SymType' SymType |
Instances
class SutSymbol a => ASTSymbol a where Source #
Represents a symbol that holds an AST
Minimal complete definition
class SutSymbol a => OffsetSymbol a where Source #
Represents a symbol that _may_ hold an offset
Minimal complete definition
Instances
class SutSymbol a => ParametricSymbol a where Source #
Represents a symbol which also has some parameters
Minimal complete definition
Instances
A Scope is just a number uniquely representing a scope (NOT a level, but an ID)
data SymFunction Source #
A (top-level) function
A (top-level) module
A person who may do things in the story
type SymTable = Map SutID [SutSymbol'] Source #
A SymTable represents the SymTable of a Sutori parsing, so
it matches a SutID (symbol name) to a list of symbols
A reference to a (now named) type
Constructors
| CatModule | |
| CatPerson | |
| CatType | |
| CatVariable | |
| CatFunction | |
| CatMember |
class SutSymbol a => TypedSymbol a where Source #
Represents a symbol with a type
Minimal complete definition
Instances
insertSymbol :: SutSymbol' -> SymTable -> SymTable Source #
Inserts a symbol into its ID stack in the map
lookupSymbols :: SutID -> SymTable -> Maybe [SutSymbol'] Source #
Lookup the list of symbols using the given ID
lookupSymbolsVariable :: SutID -> SymTable -> [SymVariable] Source #
Lookup the list of variables with an ID
lookupSymbolsPerson :: SutID -> SymTable -> [SymPerson] Source #
Lookup the list of persons with an ID
lookupSymbolsModule :: SutID -> SymTable -> [SymModule] Source #
Lookup the list of modules with an ID
lookupSymbolsFunction :: SutID -> SymTable -> [SymFunction] Source #
Lookup the list of functions with an ID
updateSymbol :: SutSymbol' -> SymTable -> SymTable Source #
Updates (read: replaces) the head of the symbol stack (for this symbol's ID
paramByValue :: SutTypeID -> SutID -> SutParam Source #
Helper to abstract the True/False isRef field
lookupAllFunctions :: Scope -> SymTable -> [SymFunction] Source #
Lookup all defined functions in a given scope