Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!psuvax1!news From: flee@guardian.cs.psu.edu (Felix Lee) Newsgroups: comp.lang.perl Subject: Yacc vs. Bison. Message-ID: Date: 21 Oct 90 00:40:13 GMT Sender: news@cs.psu.edu (Usenet) Organization: Penn State Computer Science Lines: 30 Nntp-Posting-Host: guardian.cs.psu.edu Expect either 29 shift/reduce and 59 reduce/reduce conflicts... or 27 shift/reduce and 61 reduce/reduce conflicts... The reason for the discrepancy between yacc and bison is that there are 2 shift/reduce/reduce conflicts, which yacc reports as 4 shift/reduce conflicts and bison reports as 2 shift/reduce and 2 reduce/reduce conflicts. The state in question is listop -> LISTOP WORD . (171) listop -> LISTOP WORD . expr (172) bareword -> WORD . (180) When the next token is a '++' or '--' operator, the parser can reduce to a listop (171), shift to a state that recognizes pre-inc/dec expressions, or reduce to a bareword (180). What does this mean? Beats me. Something like, print OUT ++ $x; will parse as (print OUT (++ $x)); # shift instead of ((print OUT) ++) $x; # reduce listop or (print ('OUT' ++) $x); # reduce bareword perl.y and toke.c are a little strange. -- Felix Lee flee@cs.psu.edu