bug-bison
[Top][All Lists]
Advanced

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

LR(1) error recovery in LALR(1)


From: Hans Aberg
Subject: LR(1) error recovery in LALR(1)
Date: Tue, 01 Mar 2005 21:35:52 +0100
User-agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6

Bison --report=all evidently computes the reduction lookahead sets. If I
have understood this right, then it should be possible, as an option, to
make a LALR(1) parser that reports an error immediately, as in LR(1). There
have been a number of questions here, especially in interactive parsers,
which want to know the lookahead sets, and report entered errors
immediately.

So this suggests a feature, where the parser gets an extra table with, for
each state, these reduction lookahead sets. When, in a state, the $default
is encountered, the parser checks if the lookahead token is in the lookahead
set, and if not, immediately reports the error.

This would make there to be less need for a LR(1) feature, as GLR can handle
the fact that LALR(1) accepts a smaller grammar set than LR(1).

  Hans Aberg






reply via email to

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