|
From: | Hans Aberg |
Subject: | Re: Operator precedence with empty operator |
Date: | Tue, 23 Mar 2010 20:57:20 +0100 |
On 23 Mar 2010, at 20:32, Пётр Прохоренков wrote:
I'm trying to write a grammar file for parsing expressions. The main partgoes as following: %left '-' '+'; expr: expr '+' expr | expr '-' expr // Other operators... | expr expr | const | id ;"expr expr" here is function application, former expr is the function andlatter expression is an argument (as in Haskell).
You check the .y file of Hugs <http://haskell.org/hugs/>.
I don't understand what is wrong with %prec as documentation says it assignsprecedence to rule.
If you look into the .output file for the parsing position "." in the state of the conflicting rules, then it uses the precedences of the two token immediately before and after that dot (one token from each). If there are not two such tokens available, because they way the rules have been written, the method fails.
Hans
[Prev in Thread] | Current Thread | [Next in Thread] |