I've used Parsec for small and more complex parsing tasks, and found it works well for both.

In the past, I've used parser generators (not with Haskell), but now I find that I prefer to express a parser directly in the main programming language I'm using ... that way, it's easier to "escape" the grammar and do the things that aren't always so easy to do within the BNF-and-stuff formalisms. I find my code using Parsec is close enough to the BNF that the syntax production logic is easy enough to see. A very useful feature of Parsec is that, within what is broadly an LL(1) parsing framework, it provides a controlled limited lookahead capability.

Another useful little trick I've found using Haskell+Parsec is that for an interpreted "little language", instead of returning a data structure describing the input sentence, I can return a function that can be applied to appropriate values to execute it directly.

#g
--

At 11:36 15/02/05 +0100, 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?

Best Wishes,
Johan

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

------------ Graham Klyne For email: http://www.ninebynine.org/#Contact

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to