Burke–Fisher error repair

From HandWiki
Revision as of 07:41, 27 June 2023 by JStaso (talk | contribs) (simplify)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Burke–Fisher error repair is a technique used in compilers of computer programming languages to enhance error feedback to the programmer.[1]

Background

When a compiler encounters an error when parsing a computer program it may be the first error of many. Hence it is better for the compiler to continue parsing, and output all errors it finds, rather than report one error and halt.[2]

Burke–Fisher error repair attempts to continue parsing by 'backing up' to 'k' parse tokens before the error point, and attempting to substitute all possible tokens into all positions from that point to the point where the error was detected. This procedure is adopted because the point at which an error is detected may not be the point of the actual input error. For instance, the string 'Look up below' might be detected as invalid when 'below' is encountered, but the true error might be that 'up' has been written where 'down' was intended.[3]

If 'k' is set to '4' and an error is encountered 100 tokens into the program, the compiler will attempt to substitute all possible strings of tokens between points 96 and 100 tokens into the program. If it finds some combination that parses without error and allows it to continue it will do so, reporting other errors as it goes. Usually the compiler will not produce a compiled program even if it manages to parse the entire input text after 'fixing' an error, as the newly 'fixed' program may not be what the programmer intended.

References

  1. Dain, J.A.. A Practical Minimum Distance Method for Syntax Error Handling. https://www.dcs.warwick.ac.uk/report/pdfs/cs-rr-215.pdf. 
  2. Alwabel, Abdulelah (2021-03-04). "CoEdit: A novel error correction mechanism in compilers using spelling correction algorithms" (in en). Journal of King Saud University - Computer and Information Sciences 34 (10): 8490–8500. doi:10.1016/j.jksuci.2021.02.010. ISSN 1319-1578. 
  3. Appel, Andrew W. (2004-07-08) (in en). Modern Compiler Implementation in C. Cambridge University Press. ISBN 978-1-107-26856-2. https://books.google.com/books?id=obI0AAAAQBAJ&dq=Burke%E2%80%93Fisher+error+repair&pg=PT74.