Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
On 12 jan 2010, at 00:09, Günther Schmidt wrote: Hi John, thanks for responding. As I said I've been using Parsec quite a lot, but wonder if there is a different approach possible/feasible to parsing. Parsec (2x) isn't an "online" parser, ie, it doesn't produce a result before the whole parse is completed. There is AFAIK one alternative, the uulib, but at first glance it seemed very elaborate, so I wonder if Oleg's Iteratee offers something simpler. There is the new uu-parsinglib package, which is simpler and documented (and being worked upon). Doaitse I am not in particular looking for some sort of parsec-iteratee- hybrid, I'd be quite happy with something entirely based on Iteratee. In the Iteratee package there are 2 sample parsers, one for TIFF and one for WAVE files. I wish I could say that the accompanying documentation is sufficient for me to get the idea, alas it's not. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
2010/1/12 Pasqualino "Titto" Assini : > The frisby parser (http://repetae.net/computer/frisby/) that > unfortunately is not well known as it has never been uploaded on > hackage also supports lazy parsing. Doaitse Swierstra's new version of UU supports online parsing too: http://hackage.haskell.org/package/uu-parsinglib Later versions of the original UU.Parsing look like they incorporate a version the Steps data type from the "Polish Parsers, Step by Step" paper so they will also support online parsing. Its worth re-iterating that the type of the parse result has to support 'lazyness' for the technique to be useful... Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
The frisby parser (http://repetae.net/computer/frisby/) that unfortunately is not well known as it has never been uploaded on hackage also supports lazy parsing. titto 2010/1/12 Malcolm Wallace : >> As I said I've been using Parsec quite a lot, but wonder if there is a >> different approach possible/feasible to parsing. Parsec (2x) isn't an >> "online" parser, ie, it doesn't produce a result before the whole parse is >> completed. >> >> There is AFAIK one alternative, the uulib, > > In addition, the polyparse library provides "online", or lazy, parsing. Its > interface is somewhat similar to parsec, perhaps even simpler. (Actually, > you can freely mix lazy and strict parsing - laziness is provided by > applicative combinators, strictness by monadic combinators.) I have not yet > looked into whether it would be possible to link polyparse to iteratees. > > Regards, > Malcolm > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Pasqualino "Titto" Assini, Ph.D. http://quicquid.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
As I said I've been using Parsec quite a lot, but wonder if there is a different approach possible/feasible to parsing. Parsec (2x) isn't an "online" parser, ie, it doesn't produce a result before the whole parse is completed. There is AFAIK one alternative, the uulib, In addition, the polyparse library provides "online", or lazy, parsing. Its interface is somewhat similar to parsec, perhaps even simpler. (Actually, you can freely mix lazy and strict parsing - laziness is provided by applicative combinators, strictness by monadic combinators.) I have not yet looked into whether it would be possible to link polyparse to iteratees. Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
2010/1/12 Günther Schmidt : > Hi John, > > thanks for responding. As I said I've been using Parsec quite a lot, but > wonder if there is a different approach possible/feasible to parsing. Parsec > (2x) isn't an "online" parser, ie, it doesn't produce a result before the > whole parse is completed. > This appears to be a common source of confusion. You can produce a result by not trying to parse the entire input in one go, instead parse as much as you want to consume, then return the rest of the input with the tokens that you have collected. For example, in Parsec 2 a regular approach I use is something like: get1 = do token <- parse1token remaining <- getInput return (remaining,token) Jeff ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
Hi John, thanks for responding. As I said I've been using Parsec quite a lot, but wonder if there is a different approach possible/feasible to parsing. Parsec (2x) isn't an "online" parser, ie, it doesn't produce a result before the whole parse is completed. There is AFAIK one alternative, the uulib, but at first glance it seemed very elaborate, so I wonder if Oleg's Iteratee offers something simpler. I am not in particular looking for some sort of parsec-iteratee-hybrid, I'd be quite happy with something entirely based on Iteratee. In the Iteratee package there are 2 sample parsers, one for TIFF and one for WAVE files. I wish I could say that the accompanying documentation is sufficient for me to get the idea, alas it's not. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
2010/1/11 Jason Dagit : > > > 2010/1/11 Günther Schmidt >> >> Hi, >> >> are there any examples how to build parsers using the library in Oleg's >> iteratee package? >> >> I've been using parsec for almost all my parsing needs, in fact it was >> parsec that got me started with Haskell. > > I think you should be in contact with John Lato. Last time we had > correspondence he mentioned a hybrid between iteratees and parsec. > I don't know if I'd call it a hybrid, however there is a way to embed Parsec parsers (v.3 only) in iteratee. The necessary code is available at: http://inmachina.net/~jwlato/haskell/ParsecIteratee.hs It's intended to be used for embedding relatively small parsers in iteratees. It does concatenate chunks, so if it looks too far into the stream it can be inefficient. Chunks of up to 2000 characters shouldn't require more than 1 concat (depending on what other functions you're using). This code is available as Public Domain. Thanks to Erik de Castro Lopo for suggesting integrating iteratee and parsec in some manner. It's still pretty new, so suggestions are welcome. If you want to build parsers directly with iteratee, there currently aren't any published tutorials although I can provide some working code if you like. The interface is much lower-level than Parsec. John ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
2010/1/11 Günther Schmidt > Hi, > > are there any examples how to build parsers using the library in Oleg's > iteratee package? > > I've been using parsec for almost all my parsing needs, in fact it was > parsec that got me started with Haskell. > I think you should be in contact with John Lato. Last time we had correspondence he mentioned a hybrid between iteratees and parsec. Jason ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Parsers (Parsec and Iteratee-based Parsers)
Hi, are there any examples how to build parsers using the library in Oleg's iteratee package? I've been using parsec for almost all my parsing needs, in fact it was parsec that got me started with Haskell. I'd like to try to build a few parsers based on the left-fold-enumerator thingy and compare this approach to parsec. Any good tips how to get started? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe