Using Bison as Haskell parser generator

Martin Norbäck d95mback@dtek.chalmers.se
17 Oct 2002 17:43:37 +0200


tor 2002-10-17 klockan 17.32 skrev Simon Marlow:
> 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.

Another feature which I would love to have in Happy is support for more
EBNF stuff, like repetition and alternative.

Repetition maps to Haskell lists and alternative maps to haskell Maybe.

Since there exists a transformation from EBNF to BNF this should be
possible. Also, the transformation can take certain things into account,
like that parsing a list of things is best done like this (due to the
parser being LALR)

list_of_things ::=
  empty | list_of_things thing

instead of this more natural way

list_of_things
  empty | thing list_of_things

Regards,

	Martin