[Top][All Lists]

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

Re: Print expected tokens in yyerror function.

From: Hans Aberg
Subject: Re: Print expected tokens in yyerror function.
Date: Sat, 29 Mar 2008 14:17:27 +0100

On 29 Mar 2008, at 13:22, Claudio Saavedra wrote:
The problem is that after an error token has arrived in the input,
additional reductions can take place before an error is issued by the
parser. So, although errors are detected, they are issued at a point
hampering good error recovery.

That's exactly what the deferred parsing mechanism takes care of. If an
implementation, with a deferral level of k tokens, detects an error at
certain point, the state of the parser is restored to the state it was
before the last k tokens were shifted, "undoing" as well the
corresponding reductions. Then, the error diagnosis and correction
mechanism is invoked.

Then it might be usable (but see below).

[If I'm moving OT, please say]

The feature most asked for is finding the correct set of lookahead token, to be used in an interactive parser. The error recovery thing seems to be rather out of vogue these days, in view of very interactive computer programming - it is fairly easy to fix the problems and recompile. It is still important to have good error messages, of course, identifying the point where the error occurred.

I recommend reading 2.1.3 and 2.3.1 from [BF87], where this is explained
in complete detail.

It seems to be a member thing. :-)

  Hans Aberg

reply via email to

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