Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border1.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: LR(1) Parsing : Error Handling & Recovery Date: Mon, 21 Jul 2014 10:46:27 +0200 Organization: Compilers Central Lines: 24 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-07-047@comp.compilers> References: <14-07-023@comp.compilers> <14-07-024@comp.compilers> <14-07-026@comp.compilers> <14-07-027@comp.compilers> <14-07-029@comp.compilers> <14-07-032@comp.compilers> <14-07-034@comp.compilers> <14-07-037@comp.compilers> <14-07-043@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Trace: miucha.iecc.com 1405951794 14742 2001:470:1f07:1126:0:676f:7373:6970 (21 Jul 2014 14:09:54 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Mon, 21 Jul 2014 14:09:54 +0000 (UTC) Keywords: parse Posted-Date: 21 Jul 2014 10:09:54 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com X-Received-Bytes: 2288 X-Received-Body-CRC: 91856877 Xref: csiph.com comp.compilers:1337 Stefan Monnier schrieb: >> IMO a correct PEG parser generator should warn about ambiguities in the >> grammar, just as every other parser generator does. > > AFAIK, there can't be ambiguities in a PEG grammar, because the PEG > semantics explicitly have a "use the first match" semantics. How is a grammar related to an specific parser type? Remember the origin of my comment: >> Take your BNF and pass it to a PEG parser: a PEG parser can accept pretty much the same input syntax as a BNF parser, and can be considered as a kind of RD parser, so you'd think the result is necessarily correct. << A grammar primarily describes a language, not an parser. Almost every parser generator (including PEG) will accept a correct LL(1) grammar, and the generated parsers will accept the same language. A PEG parser *also* may be created from a grammar that is rejected by other parser generators, for contained ambiguities. That's what I consider an ambiguous grammar. DoDi