Closed sgraf812 closed 1 month ago
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.
For tests/issue93.y, the
happyExpToks
array is about 20% larger thanhappyTable
. 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 thehappyTable
.