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

Re: reduce conflict on TKAs


Thanks. I found that message and I understand the problem. Is there any way to
locally increase the lookahead (either in the grammar or effectively, using
Java code)? What should my strategy be in dealing with this problem? I
don't think I can eliminate the ambiguity from the grammar.

Any help is appreciated. I am really feeling my lack of grounding in this

P.S. - I have used hypermail to transform the SableCC mailing list archive
into HTML format for easier browsing. It can be found at

I am afraid that it will be forever out of date, because I don't have enough
time to update the archive.


On Tue, 16 Feb 1999, Etienne Gagnon wrote:

> 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/
> ----------------------------------------------------------------------

| Chad Loder - Somerville, MA, USA                 |
| EMail:     cloder@acm.org                        |
| Home Page: http://www.ccs.neu.edu/home/cloder    |