[Haskell-cafe] Parsing in Haskell

Jules Bean jules at jellybean.co.uk
Tue Feb 15 05:51:40 EST 2005


On 15 Feb 2005, at 10:36, Johan Glimming wrote:

> Hi
>
> I want to implement a little algebraic specification language in 
> Haskell, and I have a working C implementation available which uses 
> yacc/flex.
>
> What is the best way of replacing yacc/bison and (f)lex when migrating 
> the project into Haskell?
>

I imagine for small languages a lot of people roll their own parser, 
using the "the grammar is the program" idiom as demonstrated (for 
example) in one of the final chapters of Paulson's ML book. That's what 
I've done a couple of times in various functional languages. This 
approach is simple to write (educational, too, the first time you do 
it) but not particularly fast.

Then there is the parsec project which is a considerably more serious 
implementation of combinator based parsing.  
http://www.cs.uu.nl/~daan/parsec.html

Jules



More information about the Haskell-Cafe mailing list