[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to change default outcome of shift/reduce conflict?
From: |
Anthony DeRobertis |
Subject: |
Re: How to change default outcome of shift/reduce conflict? |
Date: |
Sat, 12 Jan 2002 08:16:24 -0500 |
Hans Aberg writes:
There are different styles of handling this problem. One is trying to alter
the shift to reduce somehow; I think that the Bison manual say something
about that (in the section about IF ... THEN ... ELSE).
Lookin in the "Shift/Reduce" section of "Algorithm", I don't see anything to
this effect.
The other, which I prefer myself, is to rewrite the grammar so that it is
not ambiguous anymore:
The best I have managed to do, is to do something like this:
expr_orless: (everything that was in expr, except or)
;
expr: expr_orless
| expr OR expr
;
answer_btn_list_oneplus: answer_btn_list_oneplus OR expr_orless
| expr_orless
;
This, does get rid of that shift-reduce conflict. However, it gives me two
reduce/reduce conflicts instead. Not quite sure why I'm getting those
reduce-reduces conflicts (even with -v bison doesn't seem to want to say
much)
I'd really like if there was a way to tell bison to prefer reduce over shift
in a given state. After reading the source, and watching bison work in a
debugger, it appears %prec applied to the rule will do what I want. So I now
have:
answer_btn_list_oneplus: answer_btn_list_oneplus OR expr { ... }
| expr %prec PSEUDO_MAX { ... }
;
pgpilACdbopUN.pgp
Description: PGP signature
- How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/11
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/11
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/12
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/12
- Re: How to change default outcome of shift/reduce conflict?,
Anthony DeRobertis <=
- Re: How to change default outcome of shift/reduce conflict?, Akim Demaille, 2002/01/12
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/12
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/12
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/12
- Re: How to change default outcome of shift/reduce conflict?, Akim Demaille, 2002/01/13
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/13
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/14
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/14
- Re: How to change default outcome of shift/reduce conflict?, Anthony DeRobertis, 2002/01/14
- Re: How to change default outcome of shift/reduce conflict?, Hans Aberg, 2002/01/14