-
Notifications
You must be signed in to change notification settings - Fork 68
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
Build failure only when --optimize-grammar is set; grammar with not referenced rule #70
Comments
Hello Lucas, I ran into the same issue and created this repo with what I had as minimal reproducible grammar (yours is smaller, though): https://github.com/mna/pigeon-bug-optimize-grammar-2. I tested it with your fix in the pending PR and it does work, is there any side-effect preventing the fix from being merged? Thanks, |
Hi @mna |
Ah, yeah indeed I tried it on my full grammar and it does fail elsewhere with this fix. Might be worth holding up, as it might break grammars that are otherwise working today (for those that didn't run into the issue that it solves). I'll try to find some time to investigate further next week. Thanks, |
I found the old commit and my notes about the bigger problem I found when I wrote the PR #71. The thing is, that the added search algorithm in
So the bottom line is, that the search algorithm needs to be extended with something like this:
|
Fix references when unused rules are removed Add missing cloneExpr when optimizing ZeroOrOneExpr Improves situation for #70
Optimizer also needs to detect that rules can be dropped, if they are only referred to by itself (closed cycles), see comment. |
The following grammar results in build failure, if generated with
--optimize-grammar
. The same grammar builds with out problem, if the option is not set.Minimal example:
Build error:
The text was updated successfully, but these errors were encountered: