[Haskell] grammar for Haskell?

P.C.Callaghan p.c.callaghan at durham.ac.uk
Thu Nov 4 08:24:20 EST 2004


Hello,

> We are looking into parsing full Haskell98 (probably using SableCC)
> [...]
> b) any LALR(1) grammar for Haskell98,


This file contains the grammar used in GHC.

http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/parser/Parser.y.pp



Note that there's also a module in the GHC libraries which can parse H-98
modules.  It might be easier to parse with this, then convert the result
into suitable trees in Java.

http://www.haskell.org/ghc/docs/latest/html/libraries/haskell-src/Language.Haskell.Parser.html






> e) any other concise Haskell98 grammar which is less
>      fragmented than the Haskell98 report.

I'm starting to look at adapting the grammar above for use with a
Generalized LR parser. This removes the need for the tricks required to
make the grammar LALR(1), because GLR can cope with local ambiguities.
Result: a more readable grammar. (Watch this page for news:
http://www.dur.ac.uk/p.c.callaghan/happy-glr/)


Paul


--------------------------------------------------------------------------------
Dr Paul Callaghan       (Lecturer)      Email: P.C.Callaghan at durham.ac.uk
Computer Assisted Reasoning Group, Department of Computer Science, Durham
                   http://www.dur.ac.uk/CARG



More information about the Haskell mailing list