Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!ukma!gatech!mcnc!rti!h-three!ned From: ned@h-three.UUCP (ned) Newsgroups: comp.unix.wizards Subject: Trouble with %prec in yacc Keywords: yacc %prec Message-ID: <237@h-three.UUCP> Date: 13 Jul 88 19:32:46 GMT Organization: h-three Systems, Research Triangle Park, NC Lines: 38 I can't seem to override the default precedence for rules with the %prec keyword. However, if I set the precedences for the terminal tokens involved in the declarations section, then they take effect. For example, /* start of works */ %token NAME %left ADD %left MULT %start expr %% expr : expr MULT expr | expr ADD expr | NAME ; /* end of works */ works (and compiles with no shift/reduce conflicts), but /* start of doesn't work */ %token NAME MULT ADD %left PREC_ADD %left PREC_MULT %start expr %% expr : expr MULT expr %prec PREC_MULT | expr ADD expr %prec PREC_ADD | NAME ; /* end of doesn't work */ doesn't (and compiles with 4 shift/reduce conflicts). Anyone know what I'm doing wrong? Thanks in advance. -- Ned Robie