Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Kaz Kylheku <480-992-1380@kylheku.com> Newsgroups: comp.compilers Subject: Re: Why no shift-shift conflicts? Date: Fri, 28 Jan 2022 01:20:52 -0000 (UTC) Organization: A noiseless patient Spider Lines: 27 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-01-115@comp.compilers> References: <22-01-112@comp.compilers> 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 X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:2872 On 2022-01-25, Roger L Costello 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.