Re: Error Recovery

"Thomas W. Christopher" <>
25 May 1997 13:46:03 -0400

          From comp.compilers

Related articles
Re: error recovery (1989-04-30)
Error recovery (Cayot Robert-Olivier) (1997-03-21)
Re: Error recovery (Gord Cormack) (1997-03-22)
Re: Error recovery (Peter Whillance) (1997-03-27)
Error Recovery (1997-05-12)
Re: Error Recovery (1997-05-25)
Re: Error Recovery (Thomas W. Christopher) (1997-05-25)
Re: Error Recovery (Mark Gregory) (1997-05-27)
Re: Error Recovery (Michael Roach) (1997-05-31)
| List of all articles for this month |

From: "Thomas W. Christopher" <>
Newsgroups: comp.compilers
Date: 25 May 1997 13:46:03 -0400
Organization: Illinois Institute of Technology
References: 97-05-153
Keywords: parse, errors

MarkAGr wrote:
> The one thing we rarely get around here are questions concerning
> error recovery while parsing. What systems exist already for error
> recovery, and what form do they take? What would be the ideal and how
> can we implement them? I have very few ideas in this area and would be
> happy for any suggestions.

In my LL(1) and LL(k) parsers, I use "panic mode" error recovery:

Upon detecting an unexpected token in the input, the parser throws
away input up to a "fiducial symbol" that is expected. A fiducial
symbol is a terminal symbol that ends or separates significant
sections of program, e.g. ";", "end", "else".

It then generates a replacement string of "error" tokens so that the
input is syntactically valid, albeit semantically meaningless. The
error tokens tell the semantics routines not to try processing the
input, but at least they get called with the correct number of operands,
so the compiler doesn't crash.

For a fuller description, see Chapter 6 of
or zipped Postcsript:
For a copy of the LL(1) system:
The system is written in and for the Icon programming language;
(Translations into other languages are under construction).
And for the preliminary versions of my LL(k) parser generator:
    or through
-Thomas W. Christopher

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.