[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reductions during Bison error handling

From: Paul Hilfinger
Subject: Re: Reductions during Bison error handling
Date: Mon, 13 May 2002 18:55:29 -0700

> >BTW, I think I should comment on this LALR/LR thing.  I don't believe
> >this issue has anything to do with the distinction between LR and LALR
> >parsers.  Both use identical parsing algorithms and identically
> >formatted tables.
> Not true, as LALR(1) may apply reductions before an error is detected,
> which LR will not do (see Aho et al., sec 4.7, p 240).

But see Aho, et al., pg 245, the paragraph before Example 4.48, where
they describe the Bison compaction optimization (and specifically the
substitution of a default reduction for an error entry) in the context
of LR parsing tables, NOT just LALR.

Yes, since LR splits states according to lookaheads, whereas LALR does
not.  This can indeed lead to earlier error detection, at least if you
don't use Bison's current optimization on the LR(1) tables.  If you DO
use Bison's optimization, then again you will do extra reductions
before the error reduction.  Contrariwise, if you DON'T use Bison's
current optimization, then you will detect some errors sooner, even
with LALR(1).  

Paul Hilfinger

reply via email to

[Prev in Thread] Current Thread [Next in Thread]