This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH WIP] Use Levenshtein distance for various misspellings in C frontend v2


On 09/16/2015 02:34 AM, Richard Biener wrote:

Btw, this looks quite expensive - I'm sure we want to limit the effort
here a bit.
A limiter is reasonable, though as it's been pointed out this only fires during error processing, so we probably have more leeway to take time and see if we can do better error recovery.

FWIW, I've used this algorithm in totally unrelated projects and while it seems expensive, it's worked out quite nicely.


So while the idea might be an improvement to selected cases it can cause
confusion as well.  And if using the suggestion for further parsing it can
cause worse followup errors (unless we can limit such "fixup" use to the
cases where we can parse the result without errors).  Consider

foo()
{
   foz = 1;
}

if we suggest 'foo' instead of foz then we'll get a more confusing followup
error if we actually use it.
True. This kind of problem is probably inherent in this kind of "I'm going assume you meant..." error recovery mechanisms.

And just to be clear, even in a successful recovery scenario, we still issue an error. The error recovery is just meant to try and give the user a hint what might have gone wrong and gracefully handle the case where they just made a minor goof. Obviously the idea here is to cut down on the number of iterations of edit-compile cycle one has to do :-)


Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]