-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reductions with empty productions #12
Comments
Thanks for the bug report (and cheers to 2024! :) ). This is indeed a regression. I thought I had handled that case but it was subtler than I expected... Long story short: when initiating a reduction there is a special case (a "limit condition") because we don't know anything about the state of the stack yet, so we have to peek at the first state, which is not part of the reduction but allow us to identify the possible reductions coming next. And the code was not handling this case correctly, because it forgot to "unconsume" this first state (the corresponding expression would have been something like And looking at it again, I got an idea that might make it possible to get rid of this special case, I will experiment... |
And thanks for the tiny example, I will keep it in the code base it is very convenient for experimenting. |
I think I found a way to simplify this case, the current master has a more uniform treatment of reductions. |
Thank you so much - just tried out current master and it works perfectly! Really liking the new syntax, I've managed to get rid of all my hacks, and there's some rules which are significantly cleaner now. Happy new year to you too! :) |
Apologies for the slew of issues here (though thank you for all the work you've done on fixing them! ❤️).
I'm continuing to update my current code to use the latest version of lrgrep, and have hit a problem where reductions for empty productions do not appear to be matched.
I've committed a small reproduction case, but just to explain what's going on here.
We have the following grammar which accepts any number of characters between two brackets (e.g.
()
,(a)
,(aaa)
).I'd like to match sentences without a closing bracket, and so have the following rule:
While this does match sentences like
(aaa
, it does not match just(
. Curiously this does work with LRgrep 2 (so usingOPAREN ; chars ; !
), so I'm assuming this is a regression rather than intentional behaviour?Sorry I can't provide more info! Still going down the rabbit hole of trying to understand how lrgrep works.
The text was updated successfully, but these errors were encountered: