How to get nice syntax error messages with Happy?
I am currently playing with the happy parser generator.
Other parser generators can give nice messages like "unexpected endline, expected 'then'". With happy I just get the current Tokens and the position of the error.
Can you give me an example of how to get erro开发者_开发知识库r messages like above?
There is a Happy feature that I have authored for this purpose.
See my blog post: Toward better GHC syntax errors
It was merged in this pull request RFC: On parse error - show the next possible tokens.
Generally, from what I've heard, if you want nice parser errors, use Parsec instead of Happy.
精彩评论