Re: Error Recovery

"Thomas W. Christopher" <tc@charlie.cns.iit.edu>
25 May 1997 13:46:03 -0400

          From comp.compilers

Related articles
Re: error recovery hankd@ee.ecn.purdue.edu (1989-04-30)
Error recovery cayot@essi.fr (Cayot Robert-Olivier) (1997-03-21)
Re: Error recovery gvcormac@plg.uwaterloo.ca (Gord Cormack) (1997-03-22)
Re: Error recovery P.Whillance@ncl.ac.uk (Peter Whillance) (1997-03-27)
Error Recovery markagr@aol.com (1997-05-12)
Re: Error Recovery nandu@longs.dr.lucent.com (1997-05-25)
Re: Error Recovery tc@charlie.cns.iit.edu (Thomas W. Christopher) (1997-05-25)
Re: Error Recovery mag01@jvcam.northern.co.uk (Mark Gregory) (1997-05-27)
Re: Error Recovery mcr@visi.com (Michael Roach) (1997-05-31)
| List of all articles for this month |

From: "Thomas W. Christopher" <tc@charlie.cns.iit.edu>
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
http://www.iit.edu/~tc/tcll1.pdf
or zipped Postcsript: http://www.iit.edu/~tc/tcll1ps.zip
For a copy of the LL(1) system: http://www.iit.edu/~tc/tcll1.zip
The system is written in and for the Icon programming language;
http://cs.arizona.edu/icon/www/
(Translations into other languages are under construction).
And for the preliminary versions of my LL(k) parser generator:
http://www.iit.edu/~tc/tcllk.zip
    or through http://www.iit.edu/~tc/toolsfor
--
-Thomas W. Christopher http://www.iit.edu/~tc
                                                tc@charlie.cns.iit.edu
--


Post a followup to this message

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