Re: Why no shift-shift conflicts?

Kaz Kylheku <480-992-1380@kylheku.com>
Fri, 28 Jan 2022 01:20:52 -0000 (UTC)

          From comp.compilers

Related articles
Why no shift-shift conflicts? costello@mitre.org (Roger L Costello) (2022-01-25)
Re: Why no shift-shift conflicts? 480-992-1380@kylheku.com (Kaz Kylheku) (2022-01-28)
Re: Why no shift-shift conflicts? anw@cuboid.co.uk (Andy Walker) (2022-01-28)
Re: Why no shift-shift conflicts? drikosev@gmail.com (Ev. Drikos) (2022-01-28)
Re: Parsing multiple inputs, was Why no shift-shift conflicts? tkoenig@netcologne.de (Thomas Koenig) (2022-01-28)
Re: Parsing multiple inputs, was Why no shift-shift conflicts? anw@cuboid.co.uk (Andy Walker) (2022-01-28)
| List of all articles for this month |

From: Kaz Kylheku <480-992-1380@kylheku.com>
Newsgroups: comp.compilers
Date: Fri, 28 Jan 2022 01:20:52 -0000 (UTC)
Organization: A noiseless patient Spider
References: 22-01-112
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="3672"; mail-complaints-to="abuse@iecc.com"
Keywords: parse, LALR
Posted-Date: 27 Jan 2022 21:21:00 EST

On 2022-01-25, Roger L Costello <costello@mitre.org> wrote:
> Hello Compiler Experts!
>
> I have read that there are shift-reduce conflicts and reduce-reduce
> conflicts.
>
> It is my understanding that a "conflict" means the parser doesn't know which
> path to take.
>
> Consider this example rule from the Bison manual:
>
> compound: '{' declarations statements '}'
> | '{' statements '}'
> ;
>
> I look at that and think, "There is ambiguity. There are two possible paths to
> take. The parser doesn't know which path to take." That is, it looks to me
> like a shift-shift conflict.


"shift" is the name of an action applied to the *input*. The input can
be regarded as a stack: to shift is to pop the next symbol from the
input stack and deal with it in the algorithm by moving it into the
algorithm's stack, and changing state.


Since there is only one input stream, there cannot be a shift-shift
conflict. There is never any choice regarding which symbol is available
from the input.


Post a followup to this message

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