happy
happy copied to clipboard
`happyExpToks` table can be larger than `happyTable`
For tests/issue93.y, the happyExpToks array is about 20% larger than happyTable. We should definitely try to compress it more, perhaps use an array of lists. Better: Error handling is not required to be fast; just reconstruct the expected tokens from the happyTable.
Error handling is not required to be fast
Are you sure? GHC relies on the error token to implement the layout rule.
Yes, in https://github.com/haskell/happy/pull/272 I produce the expected tokens lazily when the error handler (reportError, in the example) needs them. For the error token, this error handler will not even be called, unless there really is a syntax error.