public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
@ 2003-01-27 22:18 Gabriel Dos_Reis
  2003-01-27 22:32 ` Gabriel Dos Reis
  2003-01-27 22:56 ` Joseph S. Myers
  0 siblings, 2 replies; 33+ messages in thread
From: Gabriel Dos_Reis @ 2003-01-27 22:18 UTC (permalink / raw)
  To: gcc-bugs; +Cc: gcc


A fresh checkout of 3.2.2 branch fails to bootstrap on an i686-pc-linux.  
The failure happens for Objective-C as a reduce/reduce conflict in
objc-parse.y.  I can't locate a recent change to  that file.  So I
guess it must be something having to do my settings.  I'm using Bison
1.875.  Is anyone seeing this failure?

(I'm running another bootstrap on a different machine)

-- Gaby
[...]

stage1/xgcc -Bstage1/ -B/u/molotova/0/galaad/gdosreis/.target/i686-pc-linux-gnu/i686-pc-linux-gnu/bin/ -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I/u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc -I/u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc/. -I/u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc/config -I/u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc/../include -I/u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc/objc \
-c /u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc/objc/objc-lang.c -o objc-lang.o
cd /u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc/objc; \
if bison  -o op$$.c objc-parse.y ; then \
  test -f op$$.output && mv -f op$$.output objc-parse.output ; \
  mv -f op$$.c objc-parse.c ; \
else \
  rm -f op$$.* ; \
  false ; \
fi
objc-parse.y: conflicts: 31 shift/reduce, 1 reduce/reduce
objc-parse.y: expected 0 reduce/reduce conflicts
make[2]: *** [/u/molotova/0/galaad/gdosreis/src/redhat/gcc-3.2/gcc/objc/objc-parse.c] Error 1
make[2]: Leaving directory `/0/var/tmp/gdr/gcc/gcc'
make[1]: *** [stage2_build] Error 2
make[1]: Leaving directory `/0/var/tmp/gdr/gcc/gcc'
make: *** [bootstrap] Error 2

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-27 22:18 GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y Gabriel Dos_Reis
@ 2003-01-27 22:32 ` Gabriel Dos Reis
  2003-01-27 22:52   ` Paolo Carlini
  2003-01-27 22:56 ` Joseph S. Myers
  1 sibling, 1 reply; 33+ messages in thread
From: Gabriel Dos Reis @ 2003-01-27 22:32 UTC (permalink / raw)
  To: gcc-bugs; +Cc: gcc

Gabriel Dos_Reis <gdosreis@sophia.inria.fr> writes:

| A fresh checkout of 3.2.2 branch fails to bootstrap on an i686-pc-linux.  
| The failure happens for Objective-C as a reduce/reduce conflict in
| objc-parse.y.  I can't locate a recent change to  that file.  So I
| guess it must be something having to do my settings.  I'm using Bison
| 1.875.  Is anyone seeing this failure?
| 
| (I'm running another bootstrap on a different machine)

I can confirm that using Bison 1.33 I was able to bootstrap objc.

Could anyone bootstrap with Bison 1.875?

Thanks,

-- Gaby
 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-27 22:32 ` Gabriel Dos Reis
@ 2003-01-27 22:52   ` Paolo Carlini
  2003-01-27 23:10     ` Gabriel Dos Reis
  0 siblings, 1 reply; 33+ messages in thread
From: Paolo Carlini @ 2003-01-27 22:52 UTC (permalink / raw)
  To: Gabriel Dos Reis; +Cc: gcc-bugs, gcc

Gabriel Dos Reis wrote:

>Could anyone bootstrap with Bison 1.875?
>
Just tried for you, Gaby: definitely Bison 1.875 is not ok for Objc!

Paolo.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-27 22:18 GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y Gabriel Dos_Reis
  2003-01-27 22:32 ` Gabriel Dos Reis
@ 2003-01-27 22:56 ` Joseph S. Myers
  2003-01-27 23:20   ` Gabriel Dos Reis
  2003-01-28  1:47   ` Ziemowit Laski
  1 sibling, 2 replies; 33+ messages in thread
From: Joseph S. Myers @ 2003-01-27 22:56 UTC (permalink / raw)
  To: Gabriel Dos_Reis; +Cc: gcc-bugs, gcc

On Mon, 27 Jan 2003, Gabriel Dos_Reis wrote:

> A fresh checkout of 3.2.2 branch fails to bootstrap on an i686-pc-linux.  
> The failure happens for Objective-C as a reduce/reduce conflict in
> objc-parse.y.  I can't locate a recent change to  that file.  So I
> guess it must be something having to do my settings.  I'm using Bison
> 1.875.  Is anyone seeing this failure?

An objc maintainer needs to review
<http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00900.html>.

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-27 22:52   ` Paolo Carlini
@ 2003-01-27 23:10     ` Gabriel Dos Reis
  2003-01-28  0:03       ` Raja R Harinath
  0 siblings, 1 reply; 33+ messages in thread
From: Gabriel Dos Reis @ 2003-01-27 23:10 UTC (permalink / raw)
  To: Paolo Carlini; +Cc: gcc-bugs, gcc

Paolo Carlini <pcarlini@unitus.it> writes:

| Gabriel Dos Reis wrote:
| 
| >Could anyone bootstrap with Bison 1.875?
| >
| Just tried for you, Gaby: definitely Bison 1.875 is not ok for Objc!

Thanks!

I don't know whether this is a bug in objc-parse.y or a bug in Bison
1.875. I'll make a release note unless someone comes with a fix.

-- Gaby

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-27 22:56 ` Joseph S. Myers
@ 2003-01-27 23:20   ` Gabriel Dos Reis
  2003-01-28  1:47   ` Ziemowit Laski
  1 sibling, 0 replies; 33+ messages in thread
From: Gabriel Dos Reis @ 2003-01-27 23:20 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-bugs, gcc, shebs

"Joseph S. Myers" <jsm28@cam.ac.uk> writes:

| On Mon, 27 Jan 2003, Gabriel Dos_Reis wrote:
| 
| > A fresh checkout of 3.2.2 branch fails to bootstrap on an i686-pc-linux.  
| > The failure happens for Objective-C as a reduce/reduce conflict in
| > objc-parse.y.  I can't locate a recent change to  that file.  So I
| > guess it must be something having to do my settings.  I'm using Bison
| > 1.875.  Is anyone seeing this failure?
| 
| An objc maintainer needs to review
| <http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00900.html>.

Ah, I wasn't aware a fix was proposed by the guy next the wall ;-)

Thanks,

-- Gaby

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-27 23:10     ` Gabriel Dos Reis
@ 2003-01-28  0:03       ` Raja R Harinath
  2003-01-28  0:23         ` Gabriel Dos Reis
  0 siblings, 1 reply; 33+ messages in thread
From: Raja R Harinath @ 2003-01-28  0:03 UTC (permalink / raw)
  To: Gabriel Dos Reis; +Cc: Paolo Carlini, gcc-bugs, gcc

Hi,

Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> Paolo Carlini <pcarlini@unitus.it> writes:
>
> | Gabriel Dos Reis wrote:
> | 
> | >Could anyone bootstrap with Bison 1.875?
> | >
> | Just tried for you, Gaby: definitely Bison 1.875 is not ok for Objc!
>
> Thanks!
>
> I don't know whether this is a bug in objc-parse.y or a bug in Bison
> 1.875. I'll make a release note unless someone comes with a fix.

See 

  objc/9267: bison 1.875 doesn't like reduce/reduce errors with %expect N

It is a bug in 'objc-parse.y' (a misuse of %expect).  There has
been a reduce/reduce conflict in that file for quite some time.  The
comment even says so (c-parse.in):

  ifobjc
  %expect 32 /* shift/reduce conflicts, and 1 reduce/reduce conflict.  */
  end ifobjc

However, %expect, among other things, means "exactly 0 reduce/reduce
conflicts".

Older versions of bison correctly warned about finding reduce/reduce
conflicts -- thus defeating the only purpose of the %expect: avoid
warnings.

Bison 1.875 escalated the warning to an error.  The CVS version of
bison has de-escalated this back to a warning.

The correct fix to the bug: kill the %expect line in objc-parse.y.
This will have no functional change.  There was a warning before, and
there'll be a warning now, when you process objc-parse.y.  Only now,
you aren't claiming things that aren't true.

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-28  0:03       ` Raja R Harinath
@ 2003-01-28  0:23         ` Gabriel Dos Reis
  0 siblings, 0 replies; 33+ messages in thread
From: Gabriel Dos Reis @ 2003-01-28  0:23 UTC (permalink / raw)
  To: Raja R Harinath; +Cc: Paolo Carlini, gcc-bugs, shebs, gcc

Raja R Harinath <harinath@cs.umn.edu> writes:

| Hi,
| 
| Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
| 
| > Paolo Carlini <pcarlini@unitus.it> writes:
| >
| > | Gabriel Dos Reis wrote:
| > | 
| > | >Could anyone bootstrap with Bison 1.875?
| > | >
| > | Just tried for you, Gaby: definitely Bison 1.875 is not ok for Objc!
| >
| > Thanks!
| >
| > I don't know whether this is a bug in objc-parse.y or a bug in Bison
| > 1.875. I'll make a release note unless someone comes with a fix.
| 
| See 
| 
|   objc/9267: bison 1.875 doesn't like reduce/reduce errors with %expect N

Aha, thanks.

| It is a bug in 'objc-parse.y' (a misuse of %expect).  There has
| been a reduce/reduce conflict in that file for quite some time.  The
| comment even says so (c-parse.in):
| 
|   ifobjc
|   %expect 32 /* shift/reduce conflicts, and 1 reduce/reduce conflict.  */
|   end ifobjc

Interestingly, that number is 31 in my local copy of objc-parse.y.
The fix you propose sounds sensible to me.  An Objective-C maintainer
cares to comment before I make that change? 

-- Gaby

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-27 22:56 ` Joseph S. Myers
  2003-01-27 23:20   ` Gabriel Dos Reis
@ 2003-01-28  1:47   ` Ziemowit Laski
  2003-01-28  5:19     ` Gabriel Dos_Reis
  2003-01-28 11:39     ` Joseph S. Myers
  1 sibling, 2 replies; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-28  1:47 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Gabriel Dos_Reis, gcc-bugs, gcc


On Monday, Jan 27, 2003, at 14:02 US/Pacific, Joseph S. Myers wrote:

> On Mon, 27 Jan 2003, Gabriel Dos_Reis wrote:
>
>> A fresh checkout of 3.2.2 branch fails to bootstrap on an 
>> i686-pc-linux.
>> The failure happens for Objective-C as a reduce/reduce conflict in
>> objc-parse.y.  I can't locate a recent change to  that file.  So I
>> guess it must be something having to do my settings.  I'm using Bison
>> 1.875.  Is anyone seeing this failure?
>
> An objc maintainer needs to review
> <http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00900.html>.

I'm not the maintainer, but the patch is wrong.  One cannot replace
'protocolrefs' with 'non_empty_protocolrefs', as they are optional.

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-28  1:47   ` Ziemowit Laski
@ 2003-01-28  5:19     ` Gabriel Dos_Reis
  2003-01-28 11:39     ` Joseph S. Myers
  1 sibling, 0 replies; 33+ messages in thread
From: Gabriel Dos_Reis @ 2003-01-28  5:19 UTC (permalink / raw)
  To: Ziemowit Laski; +Cc: Joseph S. Myers, gcc-bugs, gcc

| On Monday, Jan 27, 2003, at 14:02 US/Pacific, Joseph S. Myers wrote:
| 
| > On Mon, 27 Jan 2003, Gabriel Dos_Reis wrote:
| >
| >> A fresh checkout of 3.2.2 branch fails to bootstrap on an 
| >> i686-pc-linux.
| >> The failure happens for Objective-C as a reduce/reduce conflict in
| >> objc-parse.y.  I can't locate a recent change to  that file.  So I
| >> guess it must be something having to do my settings.  I'm using Bison
| >> 1.875.  Is anyone seeing this failure?
| >
| > An objc maintainer needs to review
| > <http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00900.html>.
| 
| I'm not the maintainer, but the patch is wrong.  One cannot replace
| 'protocolrefs' with 'non_empty_protocolrefs', as they are optional.

Thanks for the review.  

I went with the fix that consists in removing the "%expect" directive.

Thanks,

-- Gaby

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-28  1:47   ` Ziemowit Laski
  2003-01-28  5:19     ` Gabriel Dos_Reis
@ 2003-01-28 11:39     ` Joseph S. Myers
  2003-01-28 12:43       ` Gabriel Dos Reis
  2003-01-29  0:54       ` Ziemowit Laski
  1 sibling, 2 replies; 33+ messages in thread
From: Joseph S. Myers @ 2003-01-28 11:39 UTC (permalink / raw)
  To: Ziemowit Laski; +Cc: Gabriel Dos_Reis, gcc-bugs, gcc

On Mon, 27 Jan 2003, Ziemowit Laski wrote:

> > An objc maintainer needs to review
> > <http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00900.html>.
> 
> I'm not the maintainer, but the patch is wrong.  One cannot replace
> 'protocolrefs' with 'non_empty_protocolrefs', as they are optional.

A reduce/reduce conflict is still a bug, even if the fix is more
complicated.  Removing %expect is only a workaround.

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-28 11:39     ` Joseph S. Myers
@ 2003-01-28 12:43       ` Gabriel Dos Reis
  2003-01-29  0:54       ` Ziemowit Laski
  1 sibling, 0 replies; 33+ messages in thread
From: Gabriel Dos Reis @ 2003-01-28 12:43 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Ziemowit Laski, Gabriel Dos_Reis, gcc-bugs, gcc

"Joseph S. Myers" <jsm28@cam.ac.uk> writes:

| On Mon, 27 Jan 2003, Ziemowit Laski wrote:
| 
| > > An objc maintainer needs to review
| > > <http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00900.html>.
| > 
| > I'm not the maintainer, but the patch is wrong.  One cannot replace
| > 'protocolrefs' with 'non_empty_protocolrefs', as they are optional.
| 
| A reduce/reduce conflict is still a bug, even if the fix is more
| complicated.  Removing %expect is only a workaround.

It appears that even if the '%expect' directive is left there, then
the compiler could still be build with  a version of Bison that does not
turn the warning into an error.  That is the case for every version of
Bison since 1.28 except 1.875.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-28 11:39     ` Joseph S. Myers
  2003-01-28 12:43       ` Gabriel Dos Reis
@ 2003-01-29  0:54       ` Ziemowit Laski
  2003-01-29  1:32         ` Joseph S. Myers
  1 sibling, 1 reply; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-29  0:54 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Gabriel Dos_Reis, gcc-bugs, gcc


On Monday, Jan 27, 2003, at 23:16 US/Pacific, Joseph S. Myers wrote:

> On Mon, 27 Jan 2003, Ziemowit Laski wrote:
>
>>> An objc maintainer needs to review
>>> <http://gcc.gnu.org/ml/gcc-bugs/2003-01/msg00900.html>.
>>
>> I'm not the maintainer, but the patch is wrong.  One cannot replace
>> 'protocolrefs' with 'non_empty_protocolrefs', as they are optional.
>
> A reduce/reduce conflict is still a bug, even if the fix is more
> complicated.  Removing %expect is only a workaround.

A reduce/reduce conflict is certainly an annoyance, but it is not a bug 
-- bison has a deterministic, POSIX-annointed method for dealing with 
it, which the grammar writer knows and expects.

A slightly better way, IMHO, would be to allow %expect to take an 
optional second argument

   %expect sr_conflicts [, rr_conflicts]

so that the grammar writer could state her intent more clearly.  
However, since this mechanism doesn't exist, whacking the %expect 
altogether is a sensible approach.

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-29  0:54       ` Ziemowit Laski
@ 2003-01-29  1:32         ` Joseph S. Myers
  2003-01-29  1:49           ` Ziemowit Laski
  2003-01-30  1:43           ` Joe Buck
  0 siblings, 2 replies; 33+ messages in thread
From: Joseph S. Myers @ 2003-01-29  1:32 UTC (permalink / raw)
  To: Ziemowit Laski; +Cc: Gabriel Dos_Reis, gcc-bugs, gcc

On Tue, 28 Jan 2003, Ziemowit Laski wrote:

> A reduce/reduce conflict is certainly an annoyance, but it is not a bug 
> -- bison has a deterministic, POSIX-annointed method for dealing with 
> it, which the grammar writer knows and expects.

It is, at very least, very bad grammar style, as discussed in the Bison
manual.  The grammar should be changed (even though this may make it more
complicated) to avoid the conflict.

(The number of shift/reduce conflicts not involving error recovery should
also be minimised, with each one individually analysed and justified to
show it does parse correctly.  %expect is not meant to be used to shut up
Bison by putting in the number of conflicts it says there are until it's
been verified that those conflicts are correct.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-29  1:32         ` Joseph S. Myers
@ 2003-01-29  1:49           ` Ziemowit Laski
  2003-01-29  2:18             ` Joseph S. Myers
  2003-01-30  1:43           ` Joe Buck
  1 sibling, 1 reply; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-29  1:49 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Gabriel Dos_Reis, gcc-bugs, gcc


On Tuesday, Jan 28, 2003, at 15:08 US/Pacific, Joseph S. Myers wrote:

> On Tue, 28 Jan 2003, Ziemowit Laski wrote:
>
>> A reduce/reduce conflict is certainly an annoyance, but it is not a 
>> bug
>> -- bison has a deterministic, POSIX-annointed method for dealing with 
>> it, which the grammar writer knows and expects.
>
> It is, at very least, very bad grammar style, as discussed in the Bison
> manual.  The grammar should be changed (even though this may make it 
> more
> complicated) to avoid the conflict.

Yes, but style is inherently aesthetic -- and hence subjective -- in 
nature.
If you can find an equivalent grammar that is both intuitive to the 
reader
and conflict-free, then by all means do so.  But if your conflict-free 
grammar
has more to do with Chomsky Normal Form than the language it describes, 
then
I respectfully part company. :-)  The grammar must, first and foremost, 
be
readable and maintainable.  Why else would one use a parser generator in
the first place?

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-29  1:49           ` Ziemowit Laski
@ 2003-01-29  2:18             ` Joseph S. Myers
  2003-01-29  4:09               ` Stan Shebs
  2003-01-29  6:02               ` Ziemowit Laski
  0 siblings, 2 replies; 33+ messages in thread
From: Joseph S. Myers @ 2003-01-29  2:18 UTC (permalink / raw)
  To: Ziemowit Laski; +Cc: Gabriel Dos_Reis, gcc-bugs, gcc

On Tue, 28 Jan 2003, Ziemowit Laski wrote:

> I respectfully part company. :-)  The grammar must, first and
> foremost, be readable and maintainable.  Why else would one use a
> parser generator in the first place?

Maintainability is the reason to avoid parser conflicts.  Every change to
a parser that changes the number of conflicts requires all the conflicts
to be examined carefully to ensure that the parser will parse correctly in
each case and that no conflicts have been added without good reason.

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-29  2:18             ` Joseph S. Myers
@ 2003-01-29  4:09               ` Stan Shebs
  2003-01-30  2:01                 ` Joe Buck
  2003-01-29  6:02               ` Ziemowit Laski
  1 sibling, 1 reply; 33+ messages in thread
From: Stan Shebs @ 2003-01-29  4:09 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Ziemowit Laski, Gabriel Dos_Reis, gcc-bugs, gcc

Joseph S. Myers wrote:

>On Tue, 28 Jan 2003, Ziemowit Laski wrote:
>
>
>>I respectfully part company. :-)  The grammar must, first and
>>foremost, be readable and maintainable.  Why else would one use a
>>parser generator in the first place?
>>
>
>Maintainability is the reason to avoid parser conflicts.  Every change to
>a parser that changes the number of conflicts requires all the conflicts
>to be examined carefully to ensure that the parser will parse correctly in
>each case and that no conflicts have been added without good reason.
>
It's been on my wishlist to tweak the grammar to make Bison's complaints go
away, mostly because I don't trust it not to change randomly in some way
that causes s/r and r/r cases to come out differently.  It's just that it's
crushingly dull work, and more fun to think about adding ObjC to the new
recursive descent parser... :-)

Stan

>

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-29  2:18             ` Joseph S. Myers
  2003-01-29  4:09               ` Stan Shebs
@ 2003-01-29  6:02               ` Ziemowit Laski
  1 sibling, 0 replies; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-29  6:02 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Gabriel Dos_Reis, gcc-bugs, gcc


On Tuesday, Jan 28, 2003, at 15:38 US/Pacific, Joseph S. Myers wrote:

> On Tue, 28 Jan 2003, Ziemowit Laski wrote:
>
>> I respectfully part company. :-)  The grammar must, first and
>> foremost, be readable and maintainable.  Why else would one use a
>> parser generator in the first place?
>
> Maintainability is the reason to avoid parser conflicts.  Every change 
> to
> a parser that changes the number of conflicts requires all the 
> conflicts
> to be examined carefully to ensure that the parser will parse 
> correctly in
> each case and that no conflicts have been added without good reason.

If one's _adding_ a new conflict, then I agree that one must be careful.
Ensuring that the "parser will parse correctly in each case" has a 
slight
"halting problem" flavor to it (esp. since we don't know if it parsed
things correctly to begin with); still, one should at least add a 
comment
in the grammar explaining what the conflict is and how it _should_ be
be resolved (lest the user move around the rules!).

In the case at hand, though, the reduce/reduce conflict has been there
for generations... :-)

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-29  1:32         ` Joseph S. Myers
  2003-01-29  1:49           ` Ziemowit Laski
@ 2003-01-30  1:43           ` Joe Buck
  2003-01-30  2:07             ` Joseph S. Myers
  1 sibling, 1 reply; 33+ messages in thread
From: Joe Buck @ 2003-01-30  1:43 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Ziemowit Laski, Gabriel Dos_Reis, gcc-bugs, gcc

On Tue, 28 Jan 2003, Ziemowit Laski wrote:
> > A reduce/reduce conflict is certainly an annoyance, but it is not a bug 
> > -- bison has a deterministic, POSIX-annointed method for dealing with 
> > it, which the grammar writer knows and expects.
 
On Tue, Jan 28, 2003 at 11:08:03PM +0000, Joseph S. Myers wrote:
> It is, at very least, very bad grammar style, as discussed in the Bison
> manual.  The grammar should be changed (even though this may make it more
> complicated) to avoid the conflict.

I disagree.  For languages that have a natural LALR(1) grammar, you are
correct, but Objective-C is not necessarily such a language.  If the current
parser works, it is wrong to risk breaking it.

My position would be different if we had a large team of active Objective-C
maintainers, but we don't.  Changing a grammar that has worked for years
for the sake of purity isn't a good idea, unless someone can demonstrate
that any proposed "fixed" grammar does not introduce any new breakage. 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-29  4:09               ` Stan Shebs
@ 2003-01-30  2:01                 ` Joe Buck
  0 siblings, 0 replies; 33+ messages in thread
From: Joe Buck @ 2003-01-30  2:01 UTC (permalink / raw)
  To: Stan Shebs
  Cc: Joseph S. Myers, Ziemowit Laski, Gabriel Dos_Reis, gcc-bugs, gcc

On Tue, Jan 28, 2003 at 04:41:21PM -0800, Stan Shebs wrote:
> It's been on my wishlist to tweak the grammar to make Bison's complaints go
> away, mostly because I don't trust it not to change randomly in some way
> that causes s/r and r/r cases to come out differently.  It's just that it's
> crushingly dull work, and more fun to think about adding ObjC to the new
> recursive descent parser... :-)

Precisely because we will be wanting to implement Objective-C++ on top of
Mark's new parser, I don't see why we should waste resources on the old
parser.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30  1:43           ` Joe Buck
@ 2003-01-30  2:07             ` Joseph S. Myers
  2003-01-30  3:40               ` Joe Buck
  2003-01-30  4:20               ` Ziemowit Laski
  0 siblings, 2 replies; 33+ messages in thread
From: Joseph S. Myers @ 2003-01-30  2:07 UTC (permalink / raw)
  To: Joe Buck; +Cc: Ziemowit Laski, Gabriel Dos_Reis, gcc-bugs, gcc

On Wed, 29 Jan 2003, Joe Buck wrote:

> I disagree.  For languages that have a natural LALR(1) grammar, you are
> correct, but Objective-C is not necessarily such a language.  If the current
> parser works, it is wrong to risk breaking it.

It has been suggested that cc1obj should be merged into cc1 (making 
Objective-C a runtime dialect choice).  If this is done before Neil's 
parser is available, and if it isn't done by embedding two separate Bison 
parsers in one executable, then these conflicts get introduced in the C 
grammar and risk breaking that.

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30  2:07             ` Joseph S. Myers
@ 2003-01-30  3:40               ` Joe Buck
  2003-01-30  4:20               ` Ziemowit Laski
  1 sibling, 0 replies; 33+ messages in thread
From: Joe Buck @ 2003-01-30  3:40 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Ziemowit Laski, Gabriel Dos_Reis, gcc-bugs, gcc

On Wed, 29 Jan 2003, Joe Buck wrote:
> > I disagree.  For languages that have a natural LALR(1) grammar, you are
> > correct, but Objective-C is not necessarily such a language.  If the current
> > parser works, it is wrong to risk breaking it.
 
On Wed, Jan 29, 2003 at 11:17:54PM +0000, Joseph S. Myers wrote:
> It has been suggested that cc1obj should be merged into cc1 (making 
> Objective-C a runtime dialect choice).  If this is done before Neil's 
> parser is available, and if it isn't done by embedding two separate Bison 
> parsers in one executable, then these conflicts get introduced in the C 
> grammar and risk breaking that.

Agreed; if a substantially new parser is made, reduce/reduce conflicts
should be avoided or fixed.  But if we're just maintaining the existing
parser, it's not worth messing with.
 

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30  2:07             ` Joseph S. Myers
  2003-01-30  3:40               ` Joe Buck
@ 2003-01-30  4:20               ` Ziemowit Laski
  2003-01-30  4:27                 ` Joseph S. Myers
  1 sibling, 1 reply; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-30  4:20 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Joe Buck, Gabriel Dos_Reis, gcc-bugs, gcc


On Wednesday, Jan 29, 2003, at 15:17 US/Pacific, Joseph S. Myers wrote:

> On Wed, 29 Jan 2003, Joe Buck wrote:
>
>> I disagree.  For languages that have a natural LALR(1) grammar, you 
>> are
>> correct, but Objective-C is not necessarily such a language.  If the 
>> current
>> parser works, it is wrong to risk breaking it.

Hear, hear! :-)

> It has been suggested that cc1obj should be merged into cc1 (making
> Objective-C a runtime dialect choice).  If this is done before Neil's
> parser is available, and if it isn't done by embedding two separate 
> Bison
> parsers in one executable, then these conflicts get introduced in the C
> grammar and risk breaking that.

What does "Neil's parser" refer to, exactly?  I apologize for being
out of the loop on this...

As far as ObjC conflicts breaking the C grammar, this is possible iff 
the
ObjC-conflict-prone state can be reached from "pure C" states.
This probably holds true for some of the shift/reduce conflicts,
but these can be analyzed one-by-one and resolved via appropriate %prec
annotations.

Unfortunately, bison/yacc does not have a notation which says,
"I want you to resolve this reduce/reduce conflict as follows, and I 
know
what I'm doing; trust me."  However, the 1 reduce/reduce conflict we
currently have occurs in the state with the following kernel:

         identifier_list : identifier .  (581)
         protocoldef : PROTOCOL identifier . protocolrefs $$52 
methodprotolist END  (605)
         protocolrefs : .  (607)

which is reachable _only_ from the following state:

         protocoldef : PROTOCOL . identifier protocolrefs $$52 
methodprotolist END  (605)
         protocoldef : PROTOCOL . identifier_list ';'  (606)

In other words, you must be parsing a @protocol declaration or 
definition to
even stumble upon this.  If you're compiling straight C code, you will 
never get
here.  (Perhaps we can put a comment to this effect in c-parse.in?)

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30  4:20               ` Ziemowit Laski
@ 2003-01-30  4:27                 ` Joseph S. Myers
  2003-01-30  6:56                   ` Ziemowit Laski
  0 siblings, 1 reply; 33+ messages in thread
From: Joseph S. Myers @ 2003-01-30  4:27 UTC (permalink / raw)
  To: Ziemowit Laski; +Cc: gcc-bugs, gcc

On Wed, 29 Jan 2003, Ziemowit Laski wrote:

> What does "Neil's parser" refer to, exactly?  I apologize for being
> out of the loop on this...

The recursive descent C parser Neil Booth is writing.

> As far as ObjC conflicts breaking the C grammar, this is possible iff 
> the
> ObjC-conflict-prone state can be reached from "pure C" states.
> This probably holds true for some of the shift/reduce conflicts,
> but these can be analyzed one-by-one and resolved via appropriate %prec
> annotations.

I'll expect such an analysis (with the conflicts being resolved explicitly
where possible) for any merger of the existing parsers into one parser
that decides at runtime.  (I don't care about conflicts only involved in
error recovery.)  C at present has just one conflict not involving error
recovery.

There used to be a comment at the top of c-parse.in listing the conflicts
- which was removed as very out of date and not maintained.  If the
conflicts get genuinely minimised then writing a new such comment would be
worthwhile.

The reduce/reduce conflict meaning being unable to use %expect leads to an
increased risk that it won't be noticed (in the absence of %expect) that
parser changes add conflicts they shouldn't.  This is maintenance risk for
C in the presence of a single parser with such a conflict.

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30  4:27                 ` Joseph S. Myers
@ 2003-01-30  6:56                   ` Ziemowit Laski
  2003-01-30 11:07                     ` Neil Booth
  2003-01-30 14:04                     ` Mark Mitchell
  0 siblings, 2 replies; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-30  6:56 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-bugs, gcc


On Wednesday, Jan 29, 2003, at 16:54 US/Pacific, Joseph S. Myers wrote:

> On Wed, 29 Jan 2003, Ziemowit Laski wrote:
>
>> What does "Neil's parser" refer to, exactly?  I apologize for being
>> out of the loop on this...
>
> The recursive descent C parser Neil Booth is writing.

Ok, thanks.  So this will be separate from Mark's C++ parser?  I kind of
thought it would be nice if we could eventually teach the 
recursive-descent C++
parser how to handle C and Objective-C (and thereby get Objective-C++ 
for free
-- well, almost).  This way, we could wind up with my beloved Grand 
Unified
Front-End (or GUFE). :-)  Has this been considered/explored?

>
>> As far as ObjC conflicts breaking the C grammar, this is possible iff
>> the
>> ObjC-conflict-prone state can be reached from "pure C" states.
>> This probably holds true for some of the shift/reduce conflicts,
>> but these can be analyzed one-by-one and resolved via appropriate 
>> %prec
>> annotations.
>
> I'll expect such an analysis (with the conflicts being resolved 
> explicitly
> where possible) for any merger of the existing parsers into one parser
> that decides at runtime.  (I don't care about conflicts only involved 
> in
> error recovery.)  C at present has just one conflict not involving 
> error
> recovery.

What do you mean, "decides at runtime"?

>
> There used to be a comment at the top of c-parse.in listing the 
> conflicts
> - which was removed as very out of date and not maintained.  If the
> conflicts get genuinely minimised then writing a new such comment 
> would be
> worthwhile.
>
> The reduce/reduce conflict meaning being unable to use %expect leads 
> to an
> increased risk that it won't be noticed (in the absence of %expect) 
> that
> parser changes add conflicts they shouldn't.  This is maintenance risk 
> for
> C in the presence of a single parser with such a conflict.

Agreed, but this is really a limitation of Yacc/Bison (i.e., not being 
able
to tell it, either via a second argument to %expect or some %prec-like
notation, that the reduce/reduce conflict is "ok").

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30  6:56                   ` Ziemowit Laski
@ 2003-01-30 11:07                     ` Neil Booth
  2003-01-30 14:04                     ` Mark Mitchell
  1 sibling, 0 replies; 33+ messages in thread
From: Neil Booth @ 2003-01-30 11:07 UTC (permalink / raw)
  To: Ziemowit Laski; +Cc: Joseph S. Myers, gcc-bugs, gcc

Ziemowit Laski wrote:-

> >The recursive descent C parser Neil Booth is writing.
> 
> Ok, thanks.  So this will be separate from Mark's C++ parser?  I kind of
> thought it would be nice if we could eventually teach the 
> recursive-descent C++
> parser how to handle C and Objective-C (and thereby get Objective-C++ 
> for free
> -- well, almost).  This way, we could wind up with my beloved Grand 
> Unified
> Front-End (or GUFE). :-)  Has this been considered/explored?

See subthread starting around 9 Jan 03 in thread ANSIfy cp/parser.c if
you're genuinely curious.  There's no guarantee of delivery, and there's
no consensus whether one or two parsers is a good thing.

Neil.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30  6:56                   ` Ziemowit Laski
  2003-01-30 11:07                     ` Neil Booth
@ 2003-01-30 14:04                     ` Mark Mitchell
  2003-01-30 22:43                       ` Neil Booth
  2003-01-30 23:59                       ` Ziemowit Laski
  1 sibling, 2 replies; 33+ messages in thread
From: Mark Mitchell @ 2003-01-30 14:04 UTC (permalink / raw)
  To: Ziemowit Laski, Joseph S. Myers; +Cc: gcc-bugs, gcc



--On Wednesday, January 29, 2003 05:44:10 PM -0800 Ziemowit Laski 
<zlaski@apple.com> wrote:

> -- well, almost).  This way, we could wind up with my beloved Grand
> Unified Front-End (or GUFE). :-)  Has this been considered/explored?

Yes, and that's what I think we should do.  It's sort of a race between
us and Neil, and Neil's winning. :-)

Seriously, Neil knows that his work might or might not be accepted; it
was decided that we would all decide later.

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30 14:04                     ` Mark Mitchell
@ 2003-01-30 22:43                       ` Neil Booth
  2003-01-30 23:59                       ` Ziemowit Laski
  1 sibling, 0 replies; 33+ messages in thread
From: Neil Booth @ 2003-01-30 22:43 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Ziemowit Laski, Joseph S. Myers, gcc-bugs, gcc

Mark Mitchell wrote:-

> >-- well, almost).  This way, we could wind up with my beloved Grand
> >Unified Front-End (or GUFE). :-)  Has this been considered/explored?
> 
> Yes, and that's what I think we should do.  It's sort of a race between
> us and Neil, and Neil's winning. :-)

I'm not as sure about that as you are 8-)  I estimate as long as 6
months from now before something CVS-able.  At present I don't have
much time outside weekends.  I'm simultaneously doing my best to have
much improved diagnostics, and doing that slows development down.

Neil.

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30 14:04                     ` Mark Mitchell
  2003-01-30 22:43                       ` Neil Booth
@ 2003-01-30 23:59                       ` Ziemowit Laski
  2003-01-31 13:26                         ` Joseph S. Myers
  1 sibling, 1 reply; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-30 23:59 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Joseph S. Myers, gcc-bugs, gcc


On Thursday, Jan 30, 2003, at 00:14 US/Pacific, Mark Mitchell wrote:

>
>
> --On Wednesday, January 29, 2003 05:44:10 PM -0800 Ziemowit Laski 
> <zlaski@apple.com> wrote:
>
>> -- well, almost).  This way, we could wind up with my beloved Grand
>> Unified Front-End (or GUFE). :-)  Has this been considered/explored?
>
> Yes, and that's what I think we should do.  It's sort of a race between
> us and Neil, and Neil's winning. :-)

Mark,

I looked back over the thread and I agree with you and with your 
reasoning.
Unfortunately, I don't think I have a leg to stand on in arguing this 
case,
since I don't know if/when my employer would allocate the resources 
needed
for me or others to do this work. :-(

--Zem

--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-30 23:59                       ` Ziemowit Laski
@ 2003-01-31 13:26                         ` Joseph S. Myers
  2003-01-31 21:41                           ` Ziemowit Laski
  0 siblings, 1 reply; 33+ messages in thread
From: Joseph S. Myers @ 2003-01-31 13:26 UTC (permalink / raw)
  To: Ziemowit Laski; +Cc: Mark Mitchell, gcc-bugs, gcc

On Thu, 30 Jan 2003, Ziemowit Laski wrote:

> I looked back over the thread and I agree with you and with your
> reasoning. Unfortunately, I don't think I have a leg to stand on in
> arguing this case, since I don't know if/when my employer would
> allocate the resources needed for me or others to do this work. :-(

You do not need large time allocations to do incremental development as I
proposed.  You can unify one function at a time between front ends with a
fairly small amount of time for each function, and every such merge has an
immediate benefit.

The toplevel autoconfiscation is an excellent example of how large
changes, which overall achieve a substantial reorganisation, can and
should be done incrementally.

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
  2003-01-31 13:26                         ` Joseph S. Myers
@ 2003-01-31 21:41                           ` Ziemowit Laski
  0 siblings, 0 replies; 33+ messages in thread
From: Ziemowit Laski @ 2003-01-31 21:41 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Ziemowit Laski, Mark Mitchell, gcc-bugs, gcc


On Friday, Jan 31, 2003, at 02:44 US/Pacific, Joseph S. Myers wrote:

> On Thu, 30 Jan 2003, Ziemowit Laski wrote:
>
>> I looked back over the thread and I agree with you and with your
>> reasoning. Unfortunately, I don't think I have a leg to stand on in
>> arguing this case, since I don't know if/when my employer would
>> allocate the resources needed for me or others to do this work. :-(
>
> You do not need large time allocations to do incremental development 
> as I
> proposed.  You can unify one function at a time between front ends 
> with a
> fairly small amount of time for each function, and every such merge 
> has an
> immediate benefit.

You are absolutely right in principle; however, even an incremental 
effort
on our (i.e., Apple's) part would require a diversion of resources which
may not be forthcoming.

--Zem
--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
@ 2003-01-30 23:38 Paolo Bonzini
  0 siblings, 0 replies; 33+ messages in thread
From: Paolo Bonzini @ 2003-01-30 23:38 UTC (permalink / raw)
  To: gcc

> Unfortunately, bison/yacc does not have a notation which says,
> "I want you to resolve this reduce/reduce conflict as follows, and I know
> what I'm doing; trust me." However, the 1 reduce/reduce conflict we
> currently have occurs in the state with the following kernel:

It is easy to fix this particular RR conflict, see

http://gcc.gnu.org/ml/gcc/2003-01/msg01443.html

Paolo


^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y
@ 2003-01-28 14:04 Paolo Bonzini
  0 siblings, 0 replies; 33+ messages in thread
From: Paolo Bonzini @ 2003-01-28 14:04 UTC (permalink / raw)
  To: gcc

> I'm not the maintainer, but the patch is wrong.  One cannot replace
> 'protocolrefs' with 'non_empty_protocolrefs', as they are optional.

Right. Then the solution is to add a special non-terminal to identify an
identifier_list of at least two identifiers.

!       /* The @protocol forward-declaration production introduces a
!          reduce/reduce conflict on ';', which should be resolved in
!          favor of the production 'identifier_list -> identifier'.  */
!       | PROTOCOL identifier_list ';'
!               {
!                 objc_declare_protocols ($2);
!               }

This is never reduced if identifier_list is a single identifier.

The 3.2 and 3.3 branch solution might be simply to remove %expect, but 
something else should be done on mainline (possibly 3.3 too).

While I agree in principle that reduce/reduce conflicts are bugs,
they are often (like in this case) problems in the language spec
which is not really LR(1).  Bison should have an option for
"%expect" to specify the count of RR conflicts in the grammar;
new Bisons use a Bison grammar and the change should be
quite simple.

Paolo

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2003-01-31 20:43 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-27 22:18 GCC-3.2.2 bootstrap FAILURE: 1 reduce/reduce conflict in objc-parse.y Gabriel Dos_Reis
2003-01-27 22:32 ` Gabriel Dos Reis
2003-01-27 22:52   ` Paolo Carlini
2003-01-27 23:10     ` Gabriel Dos Reis
2003-01-28  0:03       ` Raja R Harinath
2003-01-28  0:23         ` Gabriel Dos Reis
2003-01-27 22:56 ` Joseph S. Myers
2003-01-27 23:20   ` Gabriel Dos Reis
2003-01-28  1:47   ` Ziemowit Laski
2003-01-28  5:19     ` Gabriel Dos_Reis
2003-01-28 11:39     ` Joseph S. Myers
2003-01-28 12:43       ` Gabriel Dos Reis
2003-01-29  0:54       ` Ziemowit Laski
2003-01-29  1:32         ` Joseph S. Myers
2003-01-29  1:49           ` Ziemowit Laski
2003-01-29  2:18             ` Joseph S. Myers
2003-01-29  4:09               ` Stan Shebs
2003-01-30  2:01                 ` Joe Buck
2003-01-29  6:02               ` Ziemowit Laski
2003-01-30  1:43           ` Joe Buck
2003-01-30  2:07             ` Joseph S. Myers
2003-01-30  3:40               ` Joe Buck
2003-01-30  4:20               ` Ziemowit Laski
2003-01-30  4:27                 ` Joseph S. Myers
2003-01-30  6:56                   ` Ziemowit Laski
2003-01-30 11:07                     ` Neil Booth
2003-01-30 14:04                     ` Mark Mitchell
2003-01-30 22:43                       ` Neil Booth
2003-01-30 23:59                       ` Ziemowit Laski
2003-01-31 13:26                         ` Joseph S. Myers
2003-01-31 21:41                           ` Ziemowit Laski
2003-01-28 14:04 Paolo Bonzini
2003-01-30 23:38 Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).