Replace reportInsufficientPredicates with reportAmbiguity and reportPredicateResolution
- Dominant language
- Java
- Stars
- 19k
- Forks
- 3.5k
- PR merge metrics
- No merged PRs in 30d
Description
In light of antlr/antlr4#29, antlr/antlr4#31, and antlr/antlr4#32, it seems that the `reportInsufficientPredicates` message does not provide helpful information and is actually likely to mislead a developer. In particular, if predicated configs have the same priority as unpredicated configs (as required by antlr/antlr4#29), then the information most likely to help improve a grammar comes from the `reportAmbiguity` message which would be restored to situations involving predicates as part of antlr/antlr4#31.
Consider the following rules:
```
a : b1 | b2 | b3;
b1 : {false}? ID;
b2 : ID;
b3 : ID;
```
Currently, the decision in rule `a` will result in a `reportInsufficientPredicates` message, even though no predicates are present in `a` at all. The desired message is actually `reportAmbiguity` for alternatives {2..3}. Since performance can be severely impacted by the presence of predicated configs which evaluate to an unambiguous alternative, a message (possibly `reportPredicateResolution`) that predicate evaluation is being used to resolve a syntactic ambiguity for alternatives {1..3} would be useful. This message would not be sent when predicate evaluation is only being used to gate a syntactically unambiguous alternative.
Contributor guide
Research direction
No files or tests are named. Start by locating the handling for reportInsufficientPredicates and the existing reportAmbiguity logic, then trace predicate evaluation for the example grammar. Done means syntactic ambiguity reports alternatives {2..3}, predicate-based resolution can report {1..3}, and gating an unambiguous alternative emits no resolution message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100