[Haskell-cafe] Parsing and Coding

Brandon Michael Moore brandon at spew.ugcs.caltech.edu
Sat Jul 7 20:47:48 EDT 2007


On Sat, Jul 07, 2007 at 06:49:25PM +0100, Andrew Coppin wrote:
> Dave Bayer wrote:
> >I was beginning to accept that I might die before clearing my pipeline 
> >of research projects I want to code up.
> 
> ...so it's *not* just me!
> 
> >Haskell has given me new hope.
> 
> Indeed. ;-)
> 
> 
> Today I hve implemented encoders and decoders for RLE, MTF, Fibonacci 
> codes, and LZW. Next on my list is BWT, Huffman codes and arithmetic 
> coding. (That last is *very* hard though...)

You should look at Jeremy Gibbons' paper "Arithmetic coding with folds and unfolds". www.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/arith.pdf

For your more general parsing troubles, have you considered making you lower
level parsers copy the rest of the underlying input stream into each token
they produce? After that transformation a simple string might look something
like [(c,rest) | (c:rest) <- init (tails "Some characters of input")].

Brandon


More information about the Haskell-Cafe mailing list