Skip to content

Conversation

@ydah
Copy link
Member

@ydah ydah commented Dec 28, 2025

LALR parsers with default reductions can report inaccurate syntax error messages. When a default reduction is performed, the parser may consume tokens before detecting an error, leading to confusing "expected token" lists that include tokens not actually acceptable at the error point.

Additionally, %nonassoc operators can cause similar issues where the parser reports unexpected tokens in error messages.

LAC (Lookahead Correction) solves these problems by performing exploratory parsing to verify token acceptability before committing to reductions.

refs: https://www.gnu.org/software/bison/manual/html_node/LAC.html

## Motivation

LALR parsers with default reductions can report inaccurate syntax error messages. When a default reduction is performed, the parser may consume tokens before detecting an error, leading to confusing "expected token" lists that include tokens not actually acceptable at the error point.

Additionally, `%nonassoc` operators can cause similar issues where the parser reports unexpected tokens in error messages.

LAC (Lookahead Correction) solves these problems by performing exploratory parsing to verify token acceptability before committing to reductions.

refs: https://www.gnu.org/software/bison/manual/html_node/LAC.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant