Burke–Fisher error repair

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

Background

edit

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

edit
  1. ^ Dain, J.A. "A Practical Minimum Distance Method for Syntax Error Handling" (PDF) – via University of Warwick Department of Computer Science. {{cite journal}}: Cite journal requires |journal= (help)
  2. ^ Alwabel, Abdulelah (2021-03-04). "CoEdit: A novel error correction mechanism in compilers using spelling correction algorithms". Journal of King Saud University - Computer and Information Sciences. 34 (10): 8490–8500. doi:10.1016/j.jksuci.2021.02.010. ISSN 1319-1578. S2CID 233798999.
  3. ^ Appel, Andrew W. (2004-07-08). Modern Compiler Implementation in C. Cambridge University Press. ISBN 978-1-107-26856-2.