[GHC] #1215: GHC fails to respect the maximal munch rule while lexing "qualified reservedids"

Ian Lynagh igloo at earth.li
Tue Mar 13 16:41:27 EDT 2007


Context if you haven't been following:
http://hackage.haskell.org/trac/ghc/ticket/1215

On Tue, Mar 13, 2007 at 03:12:33PM -0000, GHC wrote:
> 
>  Interesting.  It turns out I misinterpreted the Haskell lexical syntax:
>  GHC lexes `M.default` as `M` `.` `default`, because `M.default` is not a
>  valid qvarid but I neglected to take into account the maximal munch rule.
> 
>  We have an open ticket for Haskell' about this:
>  http://hackage.haskell.org/cgi-bin/haskell-prime/trac.cgi/wiki/QualifiedIdentifiers
>  which was until just now
>  inaccurate (I've now fixed it).  I propose to fix GHC in 6.8 to match the
>  Haskell' proposal.

If I understand correctly then the proposal would make e.g.

    foo = Bar.where

a syntactically valid program, but one which would be guaranteed to fail
to compile with a not-in-scope error?

Wouldn't it be cleaner for it to be a lexical error? Unfortunately I'm
not sure how to say this in the grammar; the best I can come up with is:

    program      ->      {lexeme | whitespace | error }
    error        ->      [ modid . ] reservedid


Thanks
Ian



More information about the Haskell-prime mailing list