Re: What's wrong with my grammar definition in sablecc, who can help me?

zheng yang <pointerkarajan@gmail.com>
Fri, 14 May 2010 13:48:15 -0700 (PDT)

          From comp.compilers

Related articles
What's wrong with my grammar definition in sablecc, who can help me? pointerkarajan@gmail.com (zheng yang) (2010-05-09)
Re: What's wrong with my grammar definition in sablecc, who can help m gneuner2@comcast.net (George Neuner) (2010-05-11)
Re: What's wrong with my grammar definition in sablecc, who can help m pointerkarajan@gmail.com (zheng yang) (2010-05-14)
Re: What's wrong with my grammar definition in sablecc, who can help m gneuner2@comcast.net (George Neuner) (2010-05-15)
| List of all articles for this month |
From: zheng yang <pointerkarajan@gmail.com>
Newsgroups: comp.compilers
Date: Fri, 14 May 2010 13:48:15 -0700 (PDT)
Organization: Compilers Central
References: 10-05-050 10-05-058
Keywords: question
Posted-Date: 15 May 2010 02:10:55 EDT

On May 11, 11:51 am, George Neuner <gneun...@comcast.net> wrote:
> On Sun, 9 May 2010 19:38:03 -0700 (PDT), zheng yang
>
> <pointerkara...@gmail.com> wrote:
> >When I generate the parer use sablecc with the custom grammar, so many
> >reduce/shift conflicts comes up, I have modified it, but the error
> >still there, how can fix it, please help me. below is the grammar
> >file.
>
> <snip>
>
> Shift/Reduce conflicts are not necessarily errors - constructs such as
> nested IF produce them. Shift/Reduce conflicts are merely an
> indication of ambiguity in the grammar.
>
> In the following:
>
> if ( ... )
> if ( ... )
> statement1;
> else
> statement2;
>
> indentation (which the parser ignores) makes it clear that the else is
> attached to the outer IF (a reduction of the inner IF), but the ELSE
> could equally well be attached to the inner IF (a shift).
>
> The default behavior for (LA)?LR generators when faced with a
> Shift/Reduce conflict is to shift so that more context can be
> examined.
>
> In any event, we need to see the errors/warnings to help you.


the errors/warnings are:
shift/reduce conflict in state [stack: PClassDecl *] on TKClass in {
        [ PClassDecls = PClassDecl *] * followed by TKClass <reduce>,
        [ PClassHdr = * TKClass TIdentifier] <shift>



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.