[comp.lang.c++] Roskind

rjshaw@ramius.llnl.gov (Robert Shaw) (04/04/91)

Hi. After building the version of Berkeley yacc from ics.uci.edu, I ran
Roskind's
grammar through it, and get this out:

./yacc: 25 shift/reduce conflicts, 7 reduce/reduce conflicts.
s[0] = ', s[1] = !, s[2] = '
k = 5, *s = !
k = 6, *s = !
s[0] = ', s[1] = %, s[2] = '
k = 5, *s = %
k = 6, *s = %
s[0] = ', s[1] = &, s[2] = '
k = 5, *s = &
k = 6, *s = &
s[0] = ', s[1] = (, s[2] = '
k = 5, *s = (
k = 6, *s = (
s[0] = ', s[1] = ), s[2] = '
k = 5, *s = )
k = 6, *s = )
s[0] = ', s[1] = *, s[2] = '
k = 5, *s = *
k = 6, *s = *
s[0] = ', s[1] = +, s[2] = '
k = 5, *s = +
k = 6, *s = +
s[0] = ', s[1] = ,, s[2] = '
k = 5, *s = ,
k = 6, *s = ,
s[0] = ', s[1] = -, s[2] = '
k = 5, *s = -
k = 6, *s = -
s[0] = ', s[1] = ., s[2] = '
k = 5, *s = .
k = 6, *s = .
s[0] = ', s[1] = /, s[2] = '
k = 5, *s = /
k = 6, *s = /
s[0] = ', s[1] = :, s[2] = '
k = 5, *s = :
k = 6, *s = :
s[0] = ', s[1] = ;, s[2] = '
k = 5, *s = ;
k = 6, *s = ;
s[0] = ', s[1] = <, s[2] = '
k = 5, *s = <
k = 6, *s = <
s[0] = ', s[1] = =, s[2] = '
k = 5, *s = =
k = 6, *s = =
s[0] = ', s[1] = >, s[2] = '
k = 5, *s = >
k = 6, *s = >
s[0] = ', s[1] = ?, s[2] = '
k = 5, *s = ?
k = 6, *s = ?
s[0] = ', s[1] = [, s[2] = '
k = 5, *s = [
k = 6, *s = [
s[0] = ', s[1] = ], s[2] = '
k = 5, *s = ]
k = 6, *s = ]
s[0] = ', s[1] = ^, s[2] = '
k = 5, *s = ^
k = 6, *s = ^
s[0] = ', s[1] = {, s[2] = '
k = 5, *s = {
k = 6, *s = {
s[0] = ', s[1] = |, s[2] = '
k = 5, *s = |
k = 6, *s = |
s[0] = ', s[1] = }, s[2] = '
k = 5, *s = }
k = 6, *s = }
s[0] = ', s[1] = ~, s[2] = '
k = 5, *s = ~
k = 6, *s = ~

What's going on ?

Where can I find flex ?  I've never heard of it.


===============================================================================
 Rob Shaw                                              rjshaw@ocfmail.llnl.gov
===============================================================================

davidm@uunet.UU.NET (David S. Masterson) (04/05/91)

>>>>> On 3 Apr 91 18:32:21 GMT, rjshaw@ramius.llnl.gov (Robert Shaw) said:

Robert> Hi. After building the version of Berkeley yacc from ics.uci.edu, I
Robert> ran Roskind's grammar through it, and get this out:

Robert> ./yacc: 25 shift/reduce conflicts, 7 reduce/reduce conflicts.

Check the documentation with the grammar.  From what I remember of the
documentation, I believe a certain number of shift/reduce and reduce/reduce
conflicts are expected and not considered to be a problem.  I also think he
explains the reasons for the conflicts and possible ways of improving it.
--
====================================================================
David Masterson					Consilium, Inc.
(415) 691-6311					640 Clyde Ct.
uunet!cimshop!davidm				Mtn. View, CA  94043
====================================================================
"If someone thinks they know what I said, then I didn't say it!"

cline@cheetah.ece.clarkson.edu (Marshall Cline) (04/11/91)

In article <CIMSHOP!DAVIDM.91Apr4104901@uunet.UU.NET> cimshop!davidm@uunet.UU.NET (David S. Masterson) writes:

> > On 3 Apr 91 18:32:21 GMT, rjshaw@ramius.llnl.gov (Robert Shaw) said:
> > Hi. After building the version of Berkeley yacc from ics.uci.edu, I
> > ran Roskind's grammar through it, and get this out:
> > ./yacc: 25 shift/reduce conflicts, 7 reduce/reduce conflicts.

>Check the documentation with the grammar.  From what I remember of the
>documentation, I believe a certain number of shift/reduce and reduce/reduce
>conflicts are expected and not considered to be a problem.  I also think he
>explains the reasons for the conflicts and possible ways of improving it.

Actually byacc is the problem in this case.
There *used* to be an old version of byacc sitting on one of our sun3's,
and the grammar worked under that, but the new byacc version is a bust.
Apparently byacc has some fprintf's that send junk to stderr in the event
that something unexpected(?) appears in the grammar.
The output Robert Shaw saw is the result.

Unfortunately this (apparently unexercised) part of byacc generates bad
output, since the parser doesn't work unless you use the old byacc.

I guess ``new and improved'' don't always go together.

Marshall Cline
--
PS: If your company is interested in on-site C++/OOD training, drop me a line!
--
Marshall Cline / Asst.Prof / ECE Dept / Clarkson Univ / Potsdam, NY 13676
cline@sun.soe.clarkson.edu / Bitnet:BH0W@CLUTX / uunet!clutx.clarkson.edu!bh0w
Voice: 315-268-3868 / Secretary: 315-268-6511 / FAX: 315-268-7600