J. Kim, S. Oh, and Y. Lee (Korea)
compiler, error recovery, syntactic errors,
Error Recovery is a compilation process for dealing with
syntactic errors so that parsing can continue through the
syntactic errors. It aims at reporting as many errors as
possible in the source programs. This processing is very
important for the production of compilers. There have been
many research results theoretically about error recovery, but
they are not practical and have many restrictions to be
This paper proposes a simple but practical error recovery
method for LR parser. The method provides largely two
case solutions that complement each other. The first method,
the panic method, deletes certain portions of input and
adjusts state stack, and is applicable to almost all error
situations. The second one, the modifying method, corrects
parsing tables directly and deals with errors individually.
The modifying method breaks down to insertion, deletion
and replacement methods. Insertion method inserts a token
when a programmer omits a comma or a semicolon.
Deletion method removes an unnecessary token.
Replacement method removes a token when errors occur
and replaces it with the right token.
The error recovery method proposed in this paper is not
only applicable to a practical-scaled compiler but also to the
experimental compilers that are implemented as term
projects in Compiler classes. Using the suggested error
recovery method, we have implemented a practical-scaled
compiler[4,5] which translates a source program similar to a
C program into a hypothetical stack machine code called
GVM(Game Virtual Machine).