On 23 Mar 2010, at 20:32, Пётр Прохоренков wrote:
I'm trying to write a grammar file for parsing expressions. The main
part
goes 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 and
latter 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
assigns
precedence 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
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison