Skip to content
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

Predicated configs suppress reportAmbiguity #31

Closed
sharwell opened this issue Mar 1, 2012 · 3 comments
Closed

Predicated configs suppress reportAmbiguity #31

sharwell opened this issue Mar 1, 2012 · 3 comments

Comments

@sharwell
Copy link
Member

sharwell commented Mar 1, 2012

Currently, no call to reportAmbiguity occurs when one or more ATNConfig instances have a semantic context. This is particularly problematic in tracking down issues in LR rules due to the automatically inserted predicates. One way to resolve this is having ParserATNSimulator.evalSemanticContext return an IntervalSet of all passing alternatives (unpredicated or having a predicate returning true). If the set contains more than one alternative, reportAmbiguity can be called before resolving the set to a single chosen alternative.

This presents a potential problem due to the fact that resolution currently prefers the minimum passing predicated alternative as opposed to the standard minimum acceptable alternative. However, this resolution policy will have to be changed to minimum acceptable alternative to resolve #29.

@parrt
Copy link
Member

parrt commented Mar 4, 2012

Yeah, we should essentially gate out all untrue predicated alts and choose min of remaining.

For this issue, we can maybe make an option.

@sharwell
Copy link
Member Author

sharwell commented Mar 4, 2012

Fully identifying ambiguities is more work than decision making. In plain decision making mode, adaptivePredict could simply identify the first alt which has a passing config (unpredicated or predicated evaluating to true). In ambiguity detection mode, it would have to check each alternative to try and find at least one passing config, and then call reportAmbiguity if 2 or more alts remain. The ambiguity detection mode may result in more work, but the returned decision will be the same.

sharwell added a commit to sharwell/antlr4 that referenced this issue Mar 10, 2012
…l ambiguous after predicate evaluation. Remove misleading message insufficient predicates. Fixes antlr#31. Partially addresses antlr#39.
@sharwell
Copy link
Member Author

Fixed in 2cc39c2

parrt pushed a commit that referenced this issue Jun 30, 2015
Ensure self.getErrorDisplayForChar always returns str
parrt pushed a commit that referenced this issue Jun 30, 2015
Fix syntax errors under Python 3.2
parrt pushed a commit that referenced this issue Nov 7, 2016
There is no need to call ->hashCode() explicitly
@ericvergnaud ericvergnaud mentioned this issue Nov 8, 2016
KvanTTT pushed a commit to KvanTTT/antlr4 that referenced this issue Jan 22, 2024
KvanTTT pushed a commit to KvanTTT/antlr4 that referenced this issue Jan 22, 2024
replaced CodePointCharStream with StringCharStream closes antlr#31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants