First, the question.

This version of happy (according to the CHANGES file, and according to
stuff I've seen on the mailing lists) should have the appropriate
hooks to support the Haskell layout rule (i.e., the error recovery and
the monad threading through the lexer).  Do you have any examples of
parsers supporting Haskell layout?  (It doesn't have to be a real
Haskell parser; I just want to see how to support Haskell layout.)

Second, the bug report.

I assume that getting a happy-generated parser to report:
        Program error: Internal Happy error
implies a bug in happy.  Here's a parser file which can create such an
error message (greatly stripped down from my original):

-------------------- cut here --------------------
{
module ParseTP where
}

%name parsetp
%tokentype { Token }

%token
  module { TokenModule }
  id     { TokenVar }

%%

Module :: { AModule   }
        : module id  { Module }
        | error      { Module }

{

data AModule = Module 

happyError _ =  (Module)

data Token 
        = TokenModule
        | TokenVar


}
-------------------- cut here --------------------

Save the above in a file "ParseTP.y".

I found this bug with Hugs, so I'm giving a Hugs-specific reproduction
scenario; I don't think the bug itself is Hugs-specific, though.
To reproduce:
1) run "happy ParseTP.y"
2) run hugs
3) in hugs, type ":load ParseTP.hs"
4) in hugs, type "parsetp [TokenModule]"

Carl Witty
[EMAIL PROTECTED]

Reply via email to