\begin{slide}{Kombinatoren für Parser (I)}

  \begin{itemize}\itemsep 2pt
  \item Folge (and then) (ist \verb|>>=| aus der Monade)
  \item Auswahl (or)
\begin{small}
\begin{verbatim}
( <|> ) :: Parser c a -> Parser c a -> Parser c a
Parser f <|> Parser g = Parser $ \ s -> f s ++ g s
\end{verbatim}
\end{small}
\item Wiederholung (beliebig viele)
\begin{small}
\begin{verbatim}
many, many1 :: Parser c a -> Parser c [a]
many p = many1 p <|> return [] 
many1 p = do x <- p; xs <- many p; return $ x : xs
\end{verbatim}
\end{small}
\end{itemize}
\begin{verbatim}
zahl :: Parser Char Integer = do 
   zs <- many1 ziffer 
   return $ foldl ( \ a z -> 10*a+z ) 0 zs
\end{verbatim}
  
\end{slide}
