-
Notifications
You must be signed in to change notification settings - Fork 77
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
Reimplemented error tree disambiguation in Java #2035
base: error-recovery
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement 👍
I have some clarification questions, and some ideas to increase performance.
Have you measured the performance with a profiler, since 3 seconds might still be a lot, especially compared to original parsing time.
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
Also, optimized the case where no changes are detected in subtrees.
* possibly without ambiguities. | ||
*/ | ||
|
||
public synchronized IConstructor disambiguateErrors(IConstructor arg, IBool allowAmbiguity) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not need to by synchronized anymore.
This PR replaces the (naive) error disambiguation filter written in Rascal. The time complexity has been reduced from
O(n^2)
toO(n)
, wheren
is the number of nodes in the original parse forest.In practice this means that in extreme scenarios (where there are many ambiguous error trees), the time it takes to disambiguate a parse forest is about the same as the time it takes to parse the input.
For instance, in the
SlowDisambiguationBug
test case included in this PR both the parse time and disambiguation time are around 5 seconds on my machine. Disambiguation in Rascal took +- 30 minutes.