Re: LR(1) Parsing : Error Handling & Recovery

Ivan Godard <ivan@ootbcomp.com>
Thu, 17 Jul 2014 13:03:16 -0700

          From comp.compilers

Related articles
LR(1) Parsing : Error Handling & Recovery seimarao@gmail.com (Seima Rao) (2014-07-10)
Re: LR(1) Parsing : Error Handling & Recovery ivan@ootbcomp.com (Ivan Godard) (2014-07-16)
Re: LR(1) Parsing : Error Handling & Recovery news@fx29.iad.highwinds-media.com (Eric) (2014-07-16)
Re: LR(1) Parsing : Error Handling & Recovery drikosev@otenet.gr (Evangelos Drikos) (2014-07-17)
Re: LR(1) Parsing : Error Handling & Recovery ivan@ootbcomp.com (Ivan Godard) (2014-07-17)
Re: LR(1) Parsing : Error Handling & Recovery ivan@ootbcomp.com (Ivan Godard) (2014-07-17)
Re: LR(1) Parsing : Error Handling & Recovery gneuner2@comcast.net (George Neuner) (2014-07-17)
Re: LR(1) Parsing : Error Handling & Recovery wclodius@earthlink.net (2014-07-18)
Re: LR(1) Parsing : Error Handling & Recovery wclodius@earthlink.net (2014-07-18)
Re: LR(1) Parsing : Error Handling & Recovery monnier@iro.umontreal.ca (Stefan Monnier) (2014-07-18)
Re: LR(1) Parsing : Error Handling & Recovery DrDiettrich1@aol.com (Hans-Peter Diettrich) (2014-07-19)
[20 later articles]
| List of all articles for this month |

From: Ivan Godard <ivan@ootbcomp.com>
Newsgroups: comp.compilers
Date: Thu, 17 Jul 2014 13:03:16 -0700
Organization: A noiseless patient Spider
References: 14-07-023 14-07-024 14-07-026
Keywords: parse, LALR, errors
Posted-Date: 17 Jul 2014 16:15:54 EDT

On 7/17/2014 10:15 AM, Evangelos Drikos wrote:


> But, I guess they could say the same thing if they replaced the hand
> coded Fortran parser with a LALR parser. I've compared recently an
> enhanced LALR parser with gfortran; the former has better error
> recovery and in many cases more accurate error messages whereas the
> latter sometimes just prints the cliche "Unclassifiable Statement".


It is my understanding (admittedly not based on personal experience)
that adding good error handling to LALR parser generator rules leads to
rule explosion and difficulties in producing a consistent rule set
without odd corner cases. Can you comment? If possible, can you give a
sense of the difference in rule-set size and parser performance between
your improved error set and one for the same language with no error
productions at all?


BTW: the Univac 1108 Fortran II compiler had, as many batch compilers
did, a cut-off so that if the compiler went completely off the rails it
would stop printing errors and append "Not all errors listed" as a final
message.


You guessed it: at SINTEF (NTH, Trondheim) circa 1974 we had a Fortran
program whose *only* diagnostic was: "Not all errors listed".


Ivan
[The problem with LALR error recovery is that the generated parser
combines states that are the same if your program is valid, but they
are from different grammar rules, so you'd want to produce different
error messages. The size of LR(1) parser tables was an issue on a 64K
PDP-11, but they're trivial now, and I don't know of any reason other
than inertia to use LALR rather than LR(1). -John]



Post a followup to this message

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