parser expands the literal lists and literal strings to the according list or
string representation. Moreover the parser transforms the let expressions to
real functions representing constant values.
+
+As an example we show the parsing of a \CI{FunDecl} in
+Listing~\ref{lst:fundecl}. The \CI{FunDecl} is one of the most complex parsers
+and is composed of as complex subparsers. A \CI{FunDecl} parser exactly one
+complete function.
+
+First we do the non consuming \CI{peekPos} to make sure the positionality of
+the function is guaranteed in the \AST{}, after that the identifier is parsed
+which is basically a parser that transforms an \CI{IdToken} into a \CI{String}.
+
+\CI{parseBBraces} is a parser combinator built from the basic combinators that
+parses a parser when the contents are surrounded by braces. This is followed by
+a yet another helper function to parse comma separated items.
+
+Since the next element of the \ADT{} is a \CI{Maybe} the next parser is
+combined with the optional combinator since the type of a function is optional
+and when not given it will be inferred.
+
+A function consists of \emph{many} \CI{VarDecl}s and then \emph{many}
+\CI{Stmt}s. The word \emph{many} in \Yard{} means zero or more while the word
+\emph{some} means one or more. Thus we allow a function to be empty. The reason
+why \CI{flatten} is mapped on to the last argument of the \CI{liftM6} is
+because the \CI{parseStmt} returns possibly multiple \CI{Stmt}s. This is
+because in the parsing phase we expand the \CI{print} functions into multiple
+instances and thus it can be the case that from one \CI{Stmt} we actually get
+multiple.
+
+\begin{lstlisting}[
+ language=Clean,
+ label={lst:fundecl},
+ caption={Parsing a \CI{FunDecl}}]
+:: FunDecl = FunDecl Pos String [String] (Maybe Type) [VarDecl] [Stmt]
+
+parseFunDecl :: Parser Token FunDecl
+parseFunDecl = liftM6 FunDecl
+ (peekPos)
+ (parseIdent)
+ (parseBBraces $ parseSepList CommaToken parseIdent)
+ (optional (satTok DoubleColonToken *> parseFunType))
+ (satTok CBraceOpenToken *> many parseVarDecl)
+ (flatten <$> (many parseStmt <* satTok CBraceCloseToken))
+\end{lstlisting}