Re: LR(1) Parsing : Error Handling & Recovery

Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Mon, 21 Jul 2014 10:46:27 +0200

          From comp.compilers

Related articles
[13 earlier articles]
Re: LR(1) Parsing : Error Handling & Recovery haberg-news@telia.com (Hans Aberg) (2014-07-20)
Re: LR(1) Parsing : Error Handling & Recovery gneuner2@comcast.net (George Neuner) (2014-07-20)
Re: LR(1) Parsing : Error Handling & Recovery arnold@skeeve.com (2014-07-20)
Re: LR(1) Parsing : Error Handling & Recovery monnier@iro.umontreal.ca (Stefan Monnier) (2014-07-20)
Re: LR(1) Parsing : Error Handling & Recovery wclodius@earthlink.net (2014-07-20)
Re: LR(1) Parsing : Error Handling & Recovery cdodd@acm.org (Chris Dodd) (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery drikosev@otenet.gr (Evangelos Drikos) (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery haberg-news@telia.com (Hans Aberg) (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery wclodius@earthlink.net (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery gneuner2@comcast.net (George Neuner) (2014-07-25)
Re: LR(1) Parsing : Error Handling & Recovery cdodd@acm.org (Chris Dodd) (2014-07-26)
Re: LR(1) Parsing : Error Handling & Recovery DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2014-07-28)
[5 later articles]
| List of all articles for this month |

From: Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Newsgroups: comp.compilers
Date: Mon, 21 Jul 2014 10:46:27 +0200
Organization: Compilers Central
References: 14-07-023 14-07-024 14-07-026 14-07-027 14-07-029 14-07-032 14-07-034 14-07-037 14-07-043
Keywords: parse
Posted-Date: 21 Jul 2014 10:09:54 EDT

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


Post a followup to this message

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