Skip to content

Precise syntax error reporting #245

Description

@teo-tsirpanis

Context: https://discord.com/channels/944706562948231188/944706563401211946/1226641177554456626 – thanks @notYuriy for bringing this up!

Due to the state merging performed by the LALR algorithm, the expected symbols list may contain errors. To present an accurate list to the user, we can attempt reducing each symbol and include only the symbols where the reduction succeeded.

This resembles GNU Bison's LAC (Lookahead Correction) feature, which I would like to eventually add to Farkle as well. As described in Bison's documentation, LAC's exploratory reductions have no memory overhead, and I am not concerned with any time overhead, since the work scoped in this issue will happen only in error cases.

There will be some complications with default reductions, once that gets added in Farkle, but I believe it will be manageable.

One final question is whether it should be enabled by default and if so, if we want to add an option to switch to the previous behavior. At the moment I am inclined to say yes and no respectively.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions