[comp.lang.perl] Yacc vs. Bison.

flee@guardian.cs.psu.edu (Felix Lee) (10/21/90)

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

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (10/22/90)

In article <Ff!=m+v2@cs.psu.edu> flee@guardian.cs.psu.edu (Felix Lee) writes:
: perl.y and toke.c are a little strange.

Fer shure.  That's what happens when you try to shoehorn all your favorite
languages into one.  I'm always amazed how well it works, considering...

Larry