bison-patches
[Top][All Lists]
Advanced

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

Re: TODO update


From: Akim Demaille
Subject: Re: TODO update
Date: 28 Aug 2002 17:46:01 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

>>>>> "Paul" == Paul Hilfinger <address@hidden> writes:

Paul> Akim,

Hi Paul,

Sorry for not having answered before: I first meant to flush things I
had to do before my vacations, and then... went on vacations :)

Paul> I'm STILL not entirely sure I understand the problem here.

>> But now I [remember]: when there are conflicts, Bison *lies*
>> precisely to exhibit the conflicted rules.

Paul> So is the "lie" that it fails to mention that the reduction on
Paul> ')' is due to the $default rule?

I redisplay the verbose outputs from Bison and Byacc to make it easier
to read:

|     Bison:
|     state 5
|     
|         5 glorp: 'X' .  [')']
|         6 gleep: 'X' .  [')']
|     
|         ')'       reduce using rule 5 (glorp)
|         ')'       [reduce using rule 6 (gleep)]
|         $default  reduce using rule 5 (glorp)
|     
|     
|     BYacc:
|     5: reduce/reduce conflict (reduce 5, reduce 6) on ')'
|     state 5
|             glorp : 'X' .  (5)
|             gleep : 'X' .  (6)
|     
|             .  reduce 5

I meant that Bison says `in state 5, there are two actions: on ')' r5,
and otherwise r5'.  This is not true, the truth is there is a single
action: r5.  But *because* there is a conflict, because Bison makes
efforts to exhibit the conflicts, in `extracts' a part of the $default
action: that for ')'.

This is precisely what was needed for GLR: that Bison displays all the
actions, which in the present case should look like:

|         5 glorp: 'X' .  [')']
|         6 gleep: 'X' .  [')']
|     
|         ')'       reduce using rule 5 (glorp)
|         ')'       reduce using rule 6 (gleep)

if I recall correctly.






Paul> Also, I wrote

        Paul> The $default reduction is actually used, by the way, but
        Paul> not in any valid program.  If your input were

Paul> and you replied

>> Yes, but as you can see, it didn't even look at the lookahead.

Paul> Well, true.  However, there are two ways that the $default
Paul> reduction gets used (as reflected in yacc.c): in states with
Paul> only one reduction (i.e., after any suppressed reductions are
Paul> removed) and no shifts, Bison uses the $default without looking
Paul> at the lookahead, 

Hm...  I was definitely referring to this case: it exhibited its lie
by perform r5 without looking whether we have a ')' or a '$default'.

Paul> and otherwise it uses the $default when there is a null entry in
Paul> the action table for the lookahead.  I'm not sure why one is
Paul> unreal and the other is real.

But in that case, it has fetched a lookahead.  My point was that given
that it did not look at the lookahead, there is a single possible
action for it, in spite of what the output pretends: that there are
two, on on `)', and the other `$default'.  This is the LALR lie, but
the GLR truth.




reply via email to

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