parsley-0.1.1.0: A fast parser combinator library backed by Typed Template Haskell
Safe HaskellNone
LanguageHaskell2010

Parsley.Internal.Backend.Machine.State

Documentation

type HandlerStack n s o a = Vec n (Code (Handler s o a)) Source #

type Handler s o a = Rep o -> ST s (Maybe a) Source #

type Cont s o a x = x -> Rep o -> ST s (Maybe a) Source #

type SubRoutine s o a x = Cont s o a x -> Rep o -> Handler s o a -> ST s (Maybe a) Source #

type MachineMonad s o xs n r a = Reader (Ctx s o a) (Γ s o xs n r a -> Code (ST s (Maybe a))) Source #

type family Func (rs :: [Type]) s o a x where ... Source #

Equations

Func '[] s o a x = SubRoutine s o a x 
Func (r ': rs) s o a x = STRef s r -> Func rs s o a x 

data Γ s o xs n r a Source #

Constructors

Γ 

Fields

data Ctx s o a Source #

data OpStack xs where Source #

Constructors

Empty :: OpStack '[] 
Op :: Defunc x -> OpStack xs -> OpStack (x ': xs) 

data QSubRoutine s o a x Source #

Constructors

forall rs. QSubRoutine (Code (Func rs s o a x)) (Regs rs) 

newtype QJoin s o a x Source #

Constructors

QJoin 

Fields

newtype Machine s o xs n r a Source #

Constructors

Machine 

Fields

run :: Machine s o xs n r a -> Γ s o xs n r a -> Ctx s o a -> Code (ST s (Maybe a)) Source #

emptyCtx :: DMap MVar (QSubRoutine s o a) -> Ctx s o a Source #

insertSub :: MVar x -> Code (SubRoutine s o a x) -> Ctx s o a -> Ctx s o a Source #

insertΦ :: ΦVar x -> Code (Cont s o a x) -> Ctx s o a -> Ctx s o a Source #

insertNewΣ :: ΣVar x -> Maybe (Code (STRef s x)) -> Defunc x -> Ctx s o a -> Ctx s o a Source #

insertScopedΣ :: ΣVar x -> Code (STRef s x) -> Ctx s o a -> Ctx s o a Source #

cacheΣ :: ΣVar x -> Defunc x -> Ctx s o a -> Ctx s o a Source #

concreteΣ :: ΣVar x -> Ctx s o a -> Code (STRef s x) Source #

cachedΣ :: ΣVar x -> Ctx s o a -> Defunc x Source #

askSub :: MonadReader (Ctx s o a) m => MVar x -> m (Code (SubRoutine s o a x)) Source #

askΦ :: MonadReader (Ctx s o a) m => ΦVar x -> m (Code (Cont s o a x)) Source #

debugUp :: Ctx s o a -> Ctx s o a Source #

debugDown :: Ctx s o a -> Ctx s o a Source #

debugLevel :: Ctx s o a -> Int Source #

storePiggy :: Int -> Ctx s o a -> Ctx s o a Source #

breakPiggy :: Ctx s o a -> Ctx s o a Source #

spendCoin :: Ctx s o a -> Ctx s o a Source #

giveCoins :: Int -> Ctx s o a -> Ctx s o a Source #

voidCoins :: Ctx s o a -> Ctx s o a Source #

coins :: Ctx s o a -> Int Source #

hasCoin :: Ctx s o a -> Bool Source #

isBankrupt :: Ctx s o a -> Bool Source #

liquidate :: Ctx s o a -> Int Source #