[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reductions during Bison error handling
From: |
Paul Eggert |
Subject: |
Re: Reductions during Bison error handling |
Date: |
Mon, 20 May 2002 16:34:52 -0700 (PDT) |
> From: Akim Demaille <address@hidden>
> Date: 20 May 2002 10:00:56 +0200
> I wholeheartedly subscribe to your suggestion: fixing the error
> handling so that it matches the documentation. There is a side issue
> though: POSIX. I don't know the details of what POSIX requires, and
> actually, maybe it is underspecifying wrt this point. Paul (the
> Eggert one) will probably be able to help here.
POSIX does not require as much as the Bison documentation, but it does
require that the error action must be triggered whenever the input
does not parse; if that's not happening now, it is clearly a bug.
Sorry, I don't fully understand the example yet, and I have to run now
so I won't be able to look at it until later. But here are the
relevant POSIX requirements, if that helps.
The parser shall detect a syntax error when it is in a state
where the action associated with the lookahead symbol is
error....
When the parser detects a syntax error, it normally calls
yyerror( ) with the character string "syntax error" as its
argument. The call shall not be made if the parser is still
recovering from a previous error when the error is
detected. The parser is considered to be recovering from a
previous error until the parser has shifted over at least
three normal input symbols since the last error was detected
or a semantic action has executed the macro yyerrok....
When a syntax error is detected by the parser, the parser
shall check if a previous syntax error has been detected. If
a previous error was detected, and if no normal input symbols
have been shifted since the preceding error was detected, the
parser checks if the lookahead symbol is an endmarker (see
Interface to the Lexical Analyzer). If it is, the parser
shall return with a non-zero value. Otherwise, the lookahead
symbol shall be discarded and normal parsing shall resume.
When YYERROR is executed or when the parser detects a syntax
error and no previous error has been detected, or at least
one normal input symbol has been shifted since the previous
error was detected, the parser shall pop back one state at a
time until the parse stack is empty or the current state
allows a shift over error. If the parser empties the parse
stack, it shall return with a non-zero value. Otherwise, it
shall shift over error and then resume normal parsing. If the
parser reads a lookahead symbol before the error was
detected, that symbol shall still be the lookahead symbol
when parsing is resumed.
- Re: Reductions during Bison error handling, (continued)
- Re: Reductions during Bison error handling, Paul Eggert, 2002/05/21
- Re: Reductions during Bison error handling, Paul Hilfinger, 2002/05/21
- Re: Reductions during Bison error handling, Paul Eggert, 2002/05/22
- Re: Reductions during Bison error handling, Paul Hilfinger, 2002/05/22
- Re: Reductions during Bison error handling, Akim Demaille, 2002/05/23
- Re: Reductions during Bison error handling, Hans Aberg, 2002/05/23
- Re: Reductions during Bison error handling, Richard Stallman, 2002/05/23
- Re: Reductions during Bison error handling, Paul Hilfinger, 2002/05/23
- Re: Reductions during Bison error handling, Richard Stallman, 2002/05/25
- Re: Reductions during Bison error handling, Mike Castle, 2002/05/23
Re: Reductions during Bison error handling,
Paul Eggert <=
Re: Reductions during Bison error handling, Paul Hilfinger, 2002/05/13
Re: Reductions during Bison error handling, Paul Hilfinger, 2002/05/21