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 t t1 t2 t3 -> (t3 -> r'' -> r') -> (t -> Steps r'' t1 t2) -> t -> Steps r' t1 t2 Source

unR :: RealRecogn t t1 t2 -> (t -> Steps r t1 t2) -> t -> Steps r t1 t2 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 => a -> ParsRec t result s p a Source

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

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

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

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

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

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

libOr :: (Ord s, OutputState result) => ParsRec t2 t s p a -> ParsRec t2 t1 s p a -> ParsRec t2 result s p 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 t t1 -> Expecting t 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 |

(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`.

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 :: (Ord s, Symbol s, OutputState result, InputState state s p) => AnaParser state result s p a -> AnaParser state result s p a -> AnaParser state result s p a Source

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

seqZeroZero :: OutputState result => Maybe (Bool, Either t t1) -> Maybe (Bool, Either a1 (ParsRec t2 result s p a1)) -> (t -> ParsRec t2 result s p a1 -> b) -> (t1 -> ParsRec t2 result s p a1 -> b) -> (t -> a1 -> 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, OutputState a, InputState b d p) => Int# -> d -> SymbolR d -> AnaParser b a d p d Source

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

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

mapOnePars :: (ParsRec t t1 s t2 t3 -> ParsRec state result s p a) -> OneDescr t t1 s t2 t3 -> 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 |
Show Nat Source |

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 :: (Ord s, Ord a1, Symbol a1, OutputState t) => [(SymbolR a1, ParsRec t1 t s p a)] -> [(SymbolR a1, ParsRec t1 t s p a)] -> [(SymbolR a1, ParsRec t1 t s p 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