[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eiffel Grammar shift / reduce errors



This shift/reduce seems to be caused by an ambiguity in your grammar.

You have:
...
	compound =
		instruction*
		;
		
	instruction =
		{creation} P.creation |
		{call} call |
...

and a call can start with parentheses (see call_target = {paren} parenthesized |...).

Usually, programming languages guard against such ambiguities by using a statement (or "instruction") separator such as the semicolon.

Mainly, what is happening is that the parser does not know if:

foo ( bar ) ...

is a call to "foo" (without any argument), followed by a call to (bar)... , or if it is a call to "foo(bar)" (with one argument).

Doesn't Eiffel require a semicolon between statements, e.g.:

foo ; (bar)...

?

Etienne


Dave Makalsky wrote:
Hi Etienne and others:

I am still having some issues with my grammar. Now, I have a shift / shift / reduce conflict.

I read through Etienne's tricks to resolve conflicts and I am at a loss for this error.

Please advise.

- Dave Makalsky

-- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/