
On 06/05/2009 07:31, Luke Palmer wrote:
On Wed, May 6, 2009 at 12:07 AM, Rouan van Dalen
mailto:rvdalen@yahoo.co.uk> wrote: Hi everyone.
I am designing my own programming language.
I would like to know what is the best way to go about writing my compiler in haskell. What are the tools available in haskell that can help with compiler construction?
I know about Happy. Is that a good tool to use?
I don't like Happy. Using a parser generator is like admitting defeat, when we have no defeat to admit. I would recommend a parser combinator library like Parsec (or if you like building things from the ground up, ReadP).
There are distinct advantages to using a parser generator over parsing combinators. For example, you get a static guarantee that your language is unambiguous and doesn't need backtracking. (and we like static guarantees!) I seem to recall there are parsing combinators that generate LR parsing tables at runtime, which might be a good compromise though. Cheers, Simon