Using Bison as Haskell parser generator
Simon Marlow
simonmar@microsoft.com
Thu, 17 Oct 2002 16:32:54 +0100
> (I am currently not on this list, so replies, please cc me.)
>=20
> The later versions of the GNU parser generator Bison, like
> ftp://ftp.gnu.org/gnu/bison/bison-1.75.tar.gz (959 KB)
> ftp://ftp.gnu.org/gnu/bison/bison-1.75.tar.bz2 (759 KB)
> use the macro processing program M4 to produce the source code output.
>=20
> This should make it real easy to write parser generator=20
> (skeleton) files
> designed for special languages.
>=20
> So I wonder if somebody may want to make an attempt to produce such
> skeleton files for Haskell. Bison has now not only an LALR(1) parser
> algorithm, but also a GLR parser, and more is to come.
Note that Happy has support for some Haskellish things which you won't
get if you use bison to generate Haskell. For example: type signatures
on productions, and support for threading a monad around the parser.
Nevertheless, doing this sounds entirely feasible. The parser tables
generated by bison are very similar to those generated by Happy (I
peeked at bison's source when I wrote the table-generation code in
Happy), so looking at Happy's LALR(1) machine might be a good place to
start.
Cheers,
Simon