Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- type SutMonad a = ReaderT Options (StateT SutState (WriterT SutLogger (Except (SutError, SutLog)))) a
- data SutState = SutState {
- lexerPosn :: SutPosn
- lexerInput :: String
- lexerChar :: Char
- lexerStateCode :: Int
- lexerBytes :: [Word8]
- lexerDepth :: Int
- lexerString :: String
- lexerStringOn :: Bool
- parserTable :: SymTable
- parserStack :: [Scope]
- parserScopes :: Set Scope
- parserOffset :: Offset
- parserOffsetStk :: [Offset]
- parserNextScope :: Scope
- mainModule :: SutModule
- mipsRegDescriptors :: RegDescriptors
- mipsVarDescriptors :: VarDescriptors
- tacTable :: TACTable
- tacNext :: Int
- tacLabel :: Int
- typesGraph :: TypeGraph
- typesNextID :: SutTypeID
- logVerbose :: Bool
- errorCode :: SutError
- runSutMonad :: SutMonad a -> Options -> SutState -> Except (SutError, SutLog) ((a, SutState), SutLogger)
- parserCurrentScope :: SutState -> Scope
- setErrorCode :: SutError -> SutMonad ()
- initialSutoriState :: SutState
- insertScope :: SutMonad ()
- removeScope :: SutMonad ()
- whenVerbose :: SutMonad () -> SutMonad ()
- functionStarts :: SutMonad ()
Documentation
type SutMonad a = ReaderT Options (StateT SutState (WriterT SutLogger (Except (SutError, SutLog)))) a Source #
The Sutori monad. Composes state, logging and exception handling
Monadic Lexer/Parser current state.
SutState | Current error code, if any |
|
runSutMonad :: SutMonad a -> Options -> SutState -> Except (SutError, SutLog) ((a, SutState), SutLogger) Source #
Run the monad with a given action
parserCurrentScope :: SutState -> Scope Source #
Get the current open scope
setErrorCode :: SutError -> SutMonad () Source #
Set the current error code for the compilation
initialSutoriState :: SutState Source #
Initial state of a Sutori parsescanrun
insertScope :: SutMonad () Source #
Inserts a new scope into the parse
- Inserts the scope into the open scopes set.
- Pushes the scope into the open scopes stack.
- Saves the current offset to return to it once the scope is closed.
removeScope :: SutMonad () Source #
Removes last scope from the parse
- Pops closing scope from stack of open scopes.
- Removes closing scope from set of open scopes.
- Recovers previous offset to write new data over just-closed scope
whenVerbose :: SutMonad () -> SutMonad () Source #
Run a monadic action only if verbose if turned on
functionStarts :: SutMonad () Source #