[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 13:05:45 +0100

On 29 Mar 2008, at 12:50, Claudio Saavedra wrote:
It prints something like that (or used to), but the LALR(1) that
Bison uses compacts the statements in a way that when an error token
appears in the input, additional reduction can be performed. So to
get a fully correct error handling, including tokens, LR without this
type of compaction, or some search algorithm would be needed.

The Burke-Fisher technique uses a deferred parsing mechanism to simulate
a limited degree of unparsing. With this, errors, that are detected
after some reductions and shifts take place, can still be detected and
properly diagnosed and fixed.

This do works with Bison's LALR algorithm and table compactation. I have
a bison skeleton that works this way, and I'll be publishing it pretty

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. Then also, the set of lookahead tokens are not in the current state, but may be in a state after some reductions has been done.

  Hans Aberg

reply via email to

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