Burke–Fisher error repair

From Wikipedia, the free encyclopedia
Jump to: navigation, search

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

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.

Burke-Fisher 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.

So, 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 an 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.