[Haskell-beginners] Happy generated parser fails to compile.

Stephen Tetley stephen.tetley at gmail.com
Sun Sep 26 12:16:09 EDT 2010


If you run happy with the info option and a file name for the output,
happy will produce a report on the grammar:

> happy -info=INFO.txt Main.g

You are right that the three unused termianls are 'let' 'in' and '='

terminal let is unused
terminal in is unused
terminal '=' is unused

You are also importing a file Tokens_posn (presumably the lexer?)
which you haven't posted - without being able to see this or the
actual error message its rather hard to decode the error, however if
you are using the file Token_posn.x from the Alex distribution there
are two problems - one is you need Newstatement as a token, the other
is runCalc has this type:

runCalc :: String -> [Expr]
runCalc ss = calc $ alexScanTokens ss

Best wishes


More information about the Beginners mailing list