[Mono-list] [PATCH] reduce shift/reduce conflicts

Miguel de Icaza miguel@ximian.com
13 Jul 2001 18:41:32 -0400

> One of the hunks assumes we can hack the tokeniser to feed us
> fully-qualified identifiers, which seems a safe bet. (I can provide a
> patch for that if it's seen as a good idea.)

The problem with fully-qualified identifiers is that there is no way
to distinguish them from method invocations, since you can declare
variables *after* you use them, so the tokenizer lacks the information
(and even the parser, until everything is parsed) to raise this error.

This is legal code:

class X {
    void X ()
	a.b = 5; 
    SomeObject a;

> I'm not sure what we from with the grammar - if we want it to be
> identical to the spec, it'll have conflicts and there's nothing we can
> do about them. If we're prepared to be flexible for the purposes of
> implementation, this'll help clean it up.

The grammar can not be *identical* to the spec, because the spec
grammar is designed for human consumption, and our grammar is designed
for yacc consumption.

To work around this problem, we have to delay a number of decisions
after the parsing has taken place.

Can you resubmit your patch with this in mind?