GHC parsers

Simon Marlow
Thu, 22 Nov 2001 14:33:00 -0000

[ moved to ]
> we would like to adapt a Haskell parser for whatever=20
> purposes, and looked
> for one in the ghc distribution. However, in ghc 5.02, we found two
> happy-generated parsers, one in ghc/compiler/parser and one in
> hslibs/hssource which both look similar, but seem to be=20
> slightly different
> (at least their version numbers are). Could someone tell me what the
> differences are and which one we really ought to use?

The parser in hslibs/hssource is designed to be portable (it's written
in standard Haskell 98).  GHC's parser, and in particular the lexer, by
contrast uses several GHC extensions.  Also, the hssource parser doesn't
handle any GHC extensions to the Haskell syntax.  If you're looking for
a standalone Haskell parser, then hslibs/hssource is almost certainly
the way to go.