uulib-0.9.20: Haskell Utrecht Tools Library

Safe Haskell | None
Language | Haskell98

UU.Parsing.Machine

# Documentation

pDynE :: ParsRec state result s p a -> AnaParser state result s p a Source #

pDynL :: ParsRec state result s p a -> AnaParser state result s p a Source #

newtype RealParser state s p a Source #

Constructors

P (forall r' r''. (a -> r'' -> r') -> (state -> Steps r'' s p) -> state -> Steps r' s p) |

newtype RealRecogn state s p Source #

Constructors

R (forall r. (state -> Steps r s p) -> state -> Steps r s p) |

newtype RealAccept state result s p a Source #

Constructors

A (forall r. (state -> Steps r s p) -> state -> Steps (result a r) s p) |

newtype ParsRec state result s p a Source #

Constructors

PR (RealParser state s p a, RealRecogn state s p, RealAccept state result s p a) |

mkPR :: OutputState result => (RealParser t s p a, RealRecogn t s p) -> ParsRec t result s p a Source #

unP :: RealParser t3 t2 t1 t -> (t -> r'' -> r') -> (t3 -> Steps r'' t2 t1) -> t3 -> Steps r' t2 t1 Source #

unR :: RealRecogn t2 t1 t -> (t2 -> Steps r t1 t) -> t2 -> Steps r t1 t Source #

parseRecbasic :: (inp -> Steps (out c d) sym pos) -> ParsRec inp out sym pos a -> inp -> Steps (out a (out c d)) sym pos Source #

parsebasic :: (inp -> Steps (out c d) sym pos) -> AnaParser inp out sym pos a -> inp -> Steps (out a (out c d)) sym pos Source #

libAccept :: (OutputState a, InputState b s p) => ParsRec b a s p s Source #

libInsert :: (OutputState result, InputState t s p) => Int# -> s -> Expecting s -> ParsRec t result s p s Source #

libSucceed :: OutputState result => t1 -> ParsRec t result s p t1 Source #

libSeq :: (OutputState t, OutputState result) => ParsRec t3 t2 s p (t1 -> a) -> ParsRec t3 t s p t1 -> ParsRec t3 result s p a Source #

libDollar :: OutputState result => (t2 -> a) -> ParsRec t1 t s p t2 -> ParsRec t1 result s p a Source #

libDollarL :: OutputState result => t5 -> ParsRec t4 t3 t2 t1 t -> ParsRec t4 result t2 t1 t5 Source #

libDollarR :: OutputState result => t2 -> ParsRec t1 t s p a -> ParsRec t1 result s p a Source #

libSeqL :: OutputState result => ParsRec t3 t2 s p a -> ParsRec t3 t1 s p t -> ParsRec t3 result s p a Source #

libSeqR :: OutputState result => ParsRec t3 t2 s p t1 -> ParsRec t3 t s p a -> ParsRec t3 result s p a Source #

libOr :: (Ord t2, OutputState result) => ParsRec t4 t3 t2 t1 a -> ParsRec t4 t t2 t1 a -> ParsRec t4 result t2 t1 a Source #

libFail :: OutputState a => ParsRec b a c p d Source #

starting :: Steps a s p -> Expecting s Source #

hasSuccess :: Steps a s p -> Bool Source #

getStart :: Message t1 t -> Expecting t1 Source #

addToMessage :: Ord sym => Message sym pos -> Expecting sym -> Message sym pos Source #

addexpecting :: Ord s => Expecting s -> Steps val s p -> Steps val s p Source #

eor :: Ord a => Expecting a -> Expecting a -> Expecting a Source #

libBest :: Ord s => Steps b s p -> Steps b s p -> Steps b s p Source #

libBest' :: Ord s => Steps b s p -> Steps c s p -> (b -> d) -> (c -> d) -> Steps d s p Source #

isTrue :: Int# -> Bool Source #

lib_correct :: Ord s => (b -> c -> Steps d s p) -> (b -> c -> Steps d s p) -> b -> c -> Steps d s p Source #

libCorrect :: Ord s => Steps a s p -> Steps c s p -> (a -> d) -> (c -> d) -> Steps d s p Source #

data ToBeat a Source #

Constructors

ToBeat Int# a |

traverse :: ToBeat (Steps a s p) -> (Steps v s p -> Steps a s p, Steps v s p) -> Int# -> Int# -> ToBeat (Steps a s p) Source #

data AnaParser state result s p a Source #

Constructors

AnaParser |

Fields

- pars :: ParsRec state result s p a
- leng :: Nat
- zerop :: Maybe (Bool, Either a (ParsRec state result s p a))
- onep :: OneDescr state result s p a

Instances

(InputState inp s p, OutputState out) => StateParser (AnaParser (inp, st) out s p) st Source # |
Methods change :: (st -> st) -> AnaParser (inp, st) out s p st Source # set :: st -> AnaParser (inp, st) out s p st Source # get :: AnaParser (inp, st) out s p st Source #

(Ord s, Symbol s, InputState state s p, OutputState result) => IsParser (AnaParser state result s p) s Source #

The fast `AnaParser` instance of the `IsParser` class. Note that this requires a functioning `Ord` for the symbol type s, as tokens are often compared using the `compare` function in `Ord` rather than always using `==` rom `Eq`. The two do need to be consistent though, that is for any two `x1`, `x2` such that `x1 == x2` you must have `compare x1 x2 == EQ`.

Methods

pSucceed :: a -> AnaParser state result s p a Source #

pLow :: a -> AnaParser state result s p a Source #

pFail :: AnaParser state result s p a Source #

pCostRange :: Int# -> s -> SymbolR s -> AnaParser state result s p s Source #

pCostSym :: Int# -> s -> s -> AnaParser state result s p s Source #

pSym :: s -> AnaParser state result s p s Source #

pRange :: s -> SymbolR s -> AnaParser state result s p s Source #

getfirsts :: AnaParser state result s p v -> Expecting s Source #

setfirsts :: Expecting s -> AnaParser state result s p v -> AnaParser state result s p v Source #

getzerop :: AnaParser state result s p v -> Maybe (AnaParser state result s p v) Source #

getonep :: AnaParser state result s p v -> Maybe (AnaParser state result s p v) Source #

data OneDescr state result s p a Source #

Constructors

OneDescr |

Fields

- firsts :: Expecting s
- table :: [(SymbolR s, TableEntry state result s p a)]

data TableEntry state result s p a Source #

Constructors

TableEntry (ParsRec state result s p a) (Expecting s -> ParsRec state result s p a) |

anaFail :: OutputState a => AnaParser b a c p d Source #

noOneParser :: OneDescr state result s p a Source #

pEmpty :: ParsRec state result s p a -> (Bool, Either a (ParsRec state result s p a)) -> AnaParser state result s p a Source #

anaSucceed :: OutputState result => a -> AnaParser state result s p a Source #

anaLow :: OutputState result => a -> AnaParser state result s p a Source #

anaDynE :: ParsRec state result s p a -> AnaParser state result s p a Source #

anaDynL :: ParsRec state result s p a -> AnaParser state result s p a Source #

anaOr :: (OutputState result, Ord s, Symbol s, InputState state s p) => AnaParser state result s p a -> AnaParser state result s p a -> AnaParser state result s p a Source #

anaSeq :: (OutputState t5, OutputState result, Ord s, Symbol s, InputState state s p) => (t7 -> ParsRec t6 t5 s t4 t3 -> ParsRec state result s p a) -> (ParsRec t2 t1 s t t7 -> ParsRec t6 t5 s t4 t3 -> ParsRec state result s p a) -> (t7 -> t3 -> a) -> AnaParser t2 t1 s t t7 -> AnaParser t6 t5 s t4 t3 -> AnaParser state result s p a Source #

seqZeroZero :: OutputState result => Maybe (Bool, Either t3 t2) -> Maybe (Bool, Either t1 (ParsRec t result s p t1)) -> (t3 -> ParsRec t result s p t1 -> b) -> (t2 -> ParsRec t result s p t1 -> b) -> (t3 -> t1 -> a) -> Maybe (Bool, Either a b) Source #

orOneOneDescr :: Ord s => OneDescr state result s p a -> OneDescr state result s p a -> Bool -> OneDescr state result s p a Source #

anaCostRange :: (Ord d, Symbol d, InputState b d p, OutputState a) => Int# -> d -> SymbolR d -> AnaParser b a d p d Source #

anaGetFirsts :: AnaParser state result s p a -> Expecting s Source #

anaSetFirsts :: (OutputState result, Ord s, Symbol s, InputState state s p) => Expecting s -> AnaParser state result s p a -> AnaParser state result s p a Source #

mapOnePars :: (ParsRec t3 t2 s t1 t -> ParsRec state result s p a) -> OneDescr t3 t2 s t1 t -> OneDescr state result s p a Source #

mkParser :: (InputState state s p, Symbol s, Ord s, OutputState result) => Nat -> Maybe (Bool, Either a (ParsRec state result s p a)) -> OneDescr state result s p a -> AnaParser state result s p a Source #

data Nat Source #

Constructors

Zero |
Succ Nat |
Infinite |

Instances

Eq Nat Source # |
Methods (==) :: Nat -> Nat -> Bool # (/=) :: Nat -> Nat -> Bool #
Show Nat Source # |
Methods showsPrec :: Int -> Nat -> ShowS # show :: Nat -> String # showList :: [Nat] -> ShowS #

nat_le :: Nat -> Nat -> Bool Source #

nat_min :: Nat -> Nat -> (Nat, (b -> b -> c) -> b -> b -> c) Source #

nat_add :: Nat -> Nat -> Nat Source #

mergeTables :: (OutputState result, Ord t1, Ord a1, Symbol a1) => [(SymbolR a1, ParsRec t2 result t1 t a)] -> [(SymbolR a1, ParsRec t2 result t1 t a)] -> [(SymbolR a1, ParsRec t2 result t1 t a)] Source #

libMap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state, Steps r'' s p)) -> (forall r. state -> Steps r s p -> (state, Steps r s p)) -> ParsRec state result s p a -> ParsRec state result s p b Source #

pMap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state, Steps r'' s p)) -> (forall r. state -> Steps r s p -> (state, Steps r s p)) -> AnaParser state result s p a -> AnaParser state result s p b Source #

libWrap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state -> Steps r s p) -> (state, Steps r'' s p, state -> Steps r s p)) -> (forall r. state -> Steps r s p -> (state -> Steps r s p) -> (state, Steps r s p, state -> Steps r s p)) -> ParsRec state result s p a -> ParsRec state result s p b Source #

pWrap :: OutputState result => (forall r r''. (b -> r -> r'') -> state -> Steps (a, r) s p -> (state -> Steps r s p) -> (state, Steps r'' s p, state -> Steps r s p)) -> (forall r. state -> Steps r s p -> (state -> Steps r s p) -> (state, Steps r s p, state -> Steps r s p)) -> AnaParser state result s p a -> AnaParser state result s p b Source #

lookupSym :: Ord a => BinSearchTree (SymbolR a, b) -> a -> Maybe b Source #