

\begin{slide}{Elementare Parser (II)}

\begin{verbatim}
satisfy :: ( c -> Bool ) -> Parser c c
satisfy p = do 
    x <- next 
    if p x then return x else reject

expect :: Eq c => c -> Parser c c
expect c = satisfy ( == c )

ziffer :: Parser Char Integer
ziffer = do 
    c <- satisfy Data.Char.isDigit
    return $ fromIntegral 
           $ fromEnum c - fromEnum '0'
\end{verbatim}  
  
\end{slide}
