Reuse feed planning for GLR and recovery paths#96
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the error recovery mechanism in rusty_lr by removing the TriState enum and the can_accept_error state tracking. Instead, it introduces a feed-planning simulation (plan_feed_impl and apply_feed_plan) to dynamically determine if a state can accept an error token, simplifying the parser tables and code generation. The review feedback highlights several critical memory leaks in the non-deterministic (GLR) parser implementation where failed branches or sibling reductions during feed planning are not properly cleaned up from the Graph-Structured Stack (GSS). Additionally, a minor improvement was suggested to make the branch_node_and_len helper more idiomatic and avoid an explicit unwrap().
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Hello ehwan, thanks for reaching out. It looks like you've made significant improvements to the GLR feed planning and panic-mode recovery logic in this PR. Reusing the CFG simulation for feed paths and refining the branch cleanup logic should definitely improve both performance and correctness for GLR parsing. I've reviewed the changes, and they look well-structured. The addition of regression tests for recovery through nullable reduce chains and GLR recovery branch errors is particularly valuable for ensuring the stability of these complex paths. Since you've already implemented these changes, I don't have any further suggestions at this time. Good luck with the rest of the PR! |
can_feed-style CFG simulation is reused when replaying feed paths.NoActionseparate from reduce-action failures.errorand the original lookahead through full reduce-chain planning.pop()instead oftake/drainpatterns.