help-bison
[Top][All Lists]
Advanced

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

Re: Odd parser behaviour


From: Hans Aberg
Subject: Re: Odd parser behaviour
Date: Mon, 25 Sep 2006 10:07:53 +0200

On 25 Sep 2006, at 09:01, Heiko Wundram wrote:

Bison reduces everything as far as possible before erroring out (that's a general properly of LALR(1)-parsers), but here, there's absolutely no rule for it to do what you want, so the error occurs on the shift on the expected
E.

Actually, LR(1) issues an error immediately on seeing the erroneous token. LALR(1) compacts certain LR(1) states, and as a consequence of that, may perform additional reductions. But there is no general rule when this occurs, as far as I know.

So if the original question is over shaky error handling, that is just a part of the LALR(1) that Bison uses. The only way to cope with it, for now, is trial and error.

It has been discussed to give Bison a LR(1) parser option, which it does not have now, where better error handling is one motivation.

  Hans Aberg






reply via email to

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