[ I'm not quite sure if glasgow-haskell-bugs is the right place for
mailing this, but since Happy is now part of GHC... ]
Given the following (heavily boilt down) specification, Happy prints the
incredibly informative message "Fail: spontaneous" and dies.
--------------------------------------------
%tokentype { Token }
%token IDENTIFIER { TokenIdentifier }
'+' { TokenPlus }
%%
Expr :: { Int }
: Term { 42 }
Term :: { Int }
: IDENTIFIER { 42 }
| Expr '+' Term { 42 }
--------------------------------------------
The grammar is (unintentionally) ambiguous and one would expect a S/R
conflict.
Another (probably easy-to-fix) glitch: Using comments and multi-line
code confuses Happy's line numbering in error messages. (Yacc/Bison are
not better, either, but why should one imitate bad habits?) It's quite
hard to explain the advantages of frontend generators to students while
not being able to find a simple typo... :'-(
--
Sven Panne Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen Oettingenstr. 67
mailto:[EMAIL PROTECTED] D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne