[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Localized precedence declarations
From: |
Michiel Helvensteijn |
Subject: |
Localized precedence declarations |
Date: |
Sun, 21 Jun 2009 22:46:30 +0200 |
User-agent: |
KMail/1.9.9 |
Hi,
I'm designing a language with, among other things, unary and binary operators.
I use the Bison precedence declarations for operator precedence. I'm also
using the precedence declarations together with %prec to resolve some other
shift/reduce conflicts, such as the dangling else. It makes for a much
cleaner grammar, in my opinion, than building the precedences into the
grammar itself.
I'm now in the situation where I have multiple precedence
declaration 'sections', each solving a separate shift/reduce conflict. One of
them is the operator table, another would be the dangling else problem. And
there are several others. Each of them works as intended, when viewed
separately.
However, I now discover that Bison has silently resolved some previously
unknown shift/reduce conflicts that I inadvertently introduced, because it is
laying connections between my precedence sections.
Of course, I should have known this has been happening. But I would now like
to find a way to formally separate these sections in Bison.
In 2003, Frank Heckenbach described exactly the problem I am talking about:
http://lists.gnu.org/archive/html/help-bison/2003-05/msg00035.html
The discussion seems to continue in bug-bison, and a possible solution is
described there by Hans Aberg:
http://lists.gnu.org/archive/html/bug-bison/2003-05/msg00039.html
Actually, that post seems to describe a change bigger than Frank (or I)
intended. I would personally be happy simply with the separation of
precedence declarations (by {} brackets, for example).
It's now 6 years and a bit later. Has this problem been solved in Bison in the
mean time? Because I can not even find a mention of this in the manual.
Thanks in advance for your reply!
--
Michiel Helvensteijn
- Localized precedence declarations,
Michiel Helvensteijn <=