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

Re: reduce conflict on TKAs



Hi Chad.

You are right about your interpretation. 

Instead of re-explaining the error message, I will direct you to the
mailing list archive. 

Look for the message:

Subject: Re: BIG BUG
Date: Tue, 29 Dec 1998 12:27:43 -0500
From: Etienne Gagnon <egagnon@sprynet.com>

It contains an explanation of the SableCC's conflict error messages.

If you want to learn about LALR(1), you have to buy a book about
compilers/parsers. It can't be explained in a few lines.

Hint: A reduce/reduce conflict means that in a particular situation, the
parse stack contains a valid sequence for 2 reductions, given the
lookahead.

So, in your case, the parser is not able to determine if it should
reduce the identifier to a column_reference or to a qualified_name, when
it is followed by a k_a.

Here's an example that would exhibit this conflict:
prod = A column_reference k_a B | 
       A qualified_name k_a C;

So, by having a single token of lookahead, the parser cannot determine
which alternative is being parsed, and therefore do not know if your
identifier is a column_reference or a qualified name.

Etienne


-- 

----------------------------------------------------------------------
Etienne Gagnon, M.Sc.                   e-mail: gagnon@sable.mcgill.ca
Author of SableCC:                 http://www.sable.mcgill.ca/sablecc/
----------------------------------------------------------------------