uulib-0.9.20: Haskell Utrecht Tools Library

Safe HaskellNone
LanguageHaskell98

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 t1 t2 t3 t, RealRecogn t1 t2 t3) -> ParsRec t1 result t2 t3 t 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 :: (InputState t t1 t2, OutputState result) => Int# -> t1 -> Expecting t1 -> ParsRec t result t1 t2 t1 Source

libSucceed :: OutputState result => t -> ParsRec t1 result t2 t3 t Source

libSeq :: (OutputState result, OutputState t1) => ParsRec t4 t t5 t6 (t2 -> t3) -> ParsRec t4 t1 t5 t6 t2 -> ParsRec t4 result t5 t6 t3 Source

libDollar :: OutputState result => (t4 -> t5) -> ParsRec t t1 t2 t3 t4 -> ParsRec t result t2 t3 t5 Source

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

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

libSeqL :: OutputState result => ParsRec t4 t t5 t6 t3 -> ParsRec t4 t1 t5 t6 t2 -> ParsRec t4 result t5 t6 t3 Source

libSeqR :: OutputState result => ParsRec t4 t t5 t6 t1 -> ParsRec t4 t2 t5 t6 t3 -> ParsRec t4 result t5 t6 t3 Source

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

libFail :: OutputState a => ParsRec b a c p d 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

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

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

(Ord s, Symbol s, InputState state s p, OutputState result) => Alternative (AnaParser state result s p) 
(Ord s, Symbol s, InputState state s p, OutputState result, Applicative (AnaParser state result s p)) => Functor (AnaParser state result s p) 
(Ord s, Symbol s, InputState state s p, OutputState result) => Applicative (AnaParser state result s p) 
(InputState inp s p, OutputState out) => StateParser (AnaParser (inp, st) out s p) st 
(Ord s, Symbol s, InputState state s p, OutputState result) => IsParser (AnaParser state result s p) s

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) 

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

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

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

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

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

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

mergeTables :: (OutputState t2, Symbol a, Ord a, Ord t) => [(SymbolR a, ParsRec t4 t2 t t1 t3)] -> [(SymbolR a, ParsRec t4 t2 t t1 t3)] -> [(SymbolR a, ParsRec t4 t2 t t1 t3)] 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