This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH WIP] Use Levenshtein distance for various misspellings in C frontend v2
- From: Jeff Law <law at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, David Malcolm <dmalcolm at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- Date: Thu, 17 Sep 2015 13:31:24 -0600
- Subject: Re: [PATCH WIP] Use Levenshtein distance for various misspellings in C frontend v2
- Authentication-results: sourceware.org; auth=none
- References: <55F2F393 dot 9050501 at gmail dot com> <1442331491-11471-1-git-send-email-dmalcolm at redhat dot com> <CAFiYyc27FUtEgdPfohvtxQtLywBzKWUe9pYC0BJR7cJJxYL+qw at mail dot gmail dot com>
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