happy icon indicating copy to clipboard operation
happy copied to clipboard

`happyExpToks` table can be larger than `happyTable`

Open sgraf812 opened this issue 1 year ago • 2 comments

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.

sgraf812 avatar Jan 26 '24 11:01 sgraf812

Error handling is not required to be fast

Are you sure? GHC relies on the error token to implement the layout rule.

int-index avatar Feb 03 '24 13:02 int-index

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.

sgraf812 avatar Mar 06 '24 13:03 sgraf812