Monadic parsers take a string and return an abstract syntax tree (along with the unused part of the string).
There would typically be many parsers each able to match a particular part of the syntax.
A monadic parser has the type:
String -> (String,ast)
where 'ast' is the abstract syntax tree returned by the parser.
An error is indicated by an empty list.
Ambiguous grammars can return multiple results.
Monadic parsers can be combined in parallel or series.
monadic parsers in series
|We can introduce a functor which takes any type and turns it into a list of that type.|
|We can draw this as an endo-functor.|
Parser - Natural Transformations
|The unit transform creates a single valued list|
|The natural way to create a mult transform is a transform which flatterns a list of lists into a flat list.|