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

Parsley.Internal.Backend.Machine.State

Documentation

data StaHandler s o a Source #

Constructors

StaHandler (StaHandler# s o a) (Maybe (DynHandler s o a)) 

data StaCont s o a x Source #

Constructors

StaCont (StaCont# s o a x) (Maybe (DynCont s o a x)) 

type StaSubRoutine s o a x = DynCont s o a x -> Code (Rep o) -> DynHandler s o a -> Code (ST s (Maybe a)) Source #

staHandler# :: StaHandler s o a -> StaHandler# s o a Source #

mkStaHandler :: StaHandler# s o a -> StaHandler s o a Source #

staCont# :: StaCont s o a x -> StaCont# s o a x Source #

mkStaCont :: StaCont# s o a x -> StaCont s o a x Source #

type DynHandler s o a = Code (Handler# s o a) Source #

type DynCont s o a x = Code (Cont# s o a x) Source #

type DynSubRoutine s o a x = Code (SubRoutine# s o a x) Source #

type DynFunc (rs :: [Type]) s o a x = Code (Func rs s o a x) 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 #

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 -> StaSubRoutine s o a x -> Ctx s o a -> Ctx s o a Source #

insertΦ :: ΦVar x -> StaCont 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 #

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 #

qSubRoutine :: forall s o a x rs. DynFunc rs s o a x -> Regs rs -> QSubRoutine s o a x Source #

takeFreeRegisters :: Regs rs -> Ctx s o a -> (Ctx s o a -> DynSubRoutine s o a x) -> DynFunc rs s o a x Source #

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

askΦ :: MonadReader (Ctx s o a) m => ΦVar x -> m (StaCont 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 #