[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ignoring %prec

From: darrenks
Subject: Ignoring %prec
Date: Fri, 25 May 2007 15:06:16 -0400

Bison is ignoring %prec for this simple grammar:

%token NUMBER

program : expr  { };
expr : expr '+' expr %prec PRIORITY2  { };
expr : expr '-' expr %prec PRIORITY2  { };
expr : expr '*' expr %prec PRIORITY1  { };
expr : expr '/' expr %prec PRIORITY1  { };
expr : NUMBER  { };

int yyerror(char *s) {
        fprintf(stderr, "error, line %d: %s\n", yylineno, s);
        return 0;

int main(int argc, char **argv) {
        return 0;

#include "lex.yy.c"

I realize a work around is to not use %prec for this, but this is not an option for my purposes because I am attempting to create the bison grammar file automatically from a format where one specifies priority with a number in the rules.

If this is not a bug, I would appreciate any help on how to make this work properly because from all the documentation I have read it seems it ought to.

Attached is debug version + the lex file for testing purposes.


Attachment: bugreport.tgz
Description: GNU Zip compressed data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]