[Haskell-beginners] Re: Applicative Parsec

Heinrich Apfelmus apfelmus at quantentunnel.de
Sat Nov 7 03:53:07 EST 2009

Matthias Guedemann wrote:
> Hi Brent,
> thanks for the illustrative example.  
>> For example, consider parsing a file which contains a positive
>> integer, followed by that many letters.  For example,
>>   3xyz
>>   12abcdefghijkl
>> are two instances of this format.  In order to parse this, a monadic
>> interface is required, since the result of parsing the number must be
>> used to decide how many things to parse after that.
> I see, but as long as I want to parse context free grammars, it is
> sufficient?

Yep. The monadic version can handle context-sensitive grammars.
Incidentally, this is why the Utrecht parsing libraries ( uu-parsinglib
) only offers an applicative interface.



More information about the Beginners mailing list