bug-bison
[Top][All Lists]
Advanced

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

Re: Reductions during Bison error handling


From: Hans Aberg
Subject: Re: Reductions during Bison error handling
Date: Fri, 10 May 2002 11:25:40 +0200

At 19:48 -0700 2002/05/09, Paul Hilfinger wrote:
>What's going on?  Well, in the first example, Bison chooses r : 'x'
>as the default reduction, whereas it chooses q : 'x' as the default
>reduction.  The result of suppressing the code at the top is that the
>reduction to r is not taken if it is a default reduction.  If r : 'x'
>is NOT a default reduction, then the code under yyerrhandle eventually
>takes you to yyreduce rather than yyerrdefault.

I think that under all circumstances, the default reduction rules should be
as though the result of, for n >= 1,
    x: x_1 ... x_n
is the same as
    x: x_1 ... x_n { $$ = $1; }

Is that what happens in your example?

-- That is, the default selections that Bison makes use of (first rule in
the order) may look funny, because it depends not only on the grammar, but
also on how it is presented (the rule order) and even the type of parser
algorithm used (LALR(!) etc). (Also, error token shifting in LALR(1) is
different from that of LR(1) (but not reductions).) But that's just how
things are.

  Hans Aberg





reply via email to

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