[Haskell-beginners] Writing a Parser with attoparsec that reads from a list of tokens

Benjamin Edwards edwards.benj at gmail.com
Fri Mar 27 15:20:37 UTC 2015


The thing is you can write parsers for tokens, then write parsers that
consume those tokens by exclusively using the token parsers as the building
blocks rather than the raw steam, all using the same combinators and
mechanisms. This is much more flexible.

Ben

On Fri, 27 Mar 2015 at 15:08 Henk-Jan van Tuyl <hjgtuyl at chello.nl> wrote:

> On Fri, 27 Mar 2015 13:31:03 +0100, Norbert Melzer <timmelzer at gmail.com>
> wrote:
>
> > Hi there!
> >
> > I want to write some small toy language using attoparsec.
> >
> > So I thought, first step tokenize. Let attoparsec consume the input
> > stream
> > and produce a list of tokens.
> > Second step, parse tokens and produce the AST.
> >
> > Using parsec this would be possible easily and is documented. But I want
> > to
> > use attoparsec for this task, because I am interested in attoparsecs
> > capability to have the input in chunks.
>
> You can use the list of reverse dependencies for attoparsec
>    http://packdeps.haskellers.com/reverse/attoparsec
> to find usage examples.
>
> Regards,
> Henk-Jan van Tuyl
>
>
> --
> Folding at home
> What if you could share your unused computer power to help find a cure? In
> just 5 minutes you can join the world's biggest networked computer and get
> us closer sooner. Watch the video.
> http://folding.stanford.edu/
>
>
> http://Van.Tuyl.eu/
> http://members.chello.nl/hjgtuyl/tourdemonad.html
> Haskell programming
> --
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150327/b9f420e8/attachment.html>


More information about the Beginners mailing list