|
From: | Hans Aberg |
Subject: | Re: Localized precedence declarations |
Date: | Tue, 23 Jun 2009 18:26:25 +0200 |
On 21 Jun 2009, at 22:46, Michiel Helvensteijn wrote:
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 othershift/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.
The problem has not been resolved, and the type of grammar constraint precedences I made are not implemented.
One way to implement it is to not resolve the operator precedences in the grammar, but in the actions. This is the only way in the case the operator precedences are set dynamically. One program that uses (or so I remember) this approach is Hugs <http://haskell.org/>.
Hans
[Prev in Thread] | Current Thread | [Next in Thread] |