On Thursday, 31 October 2019 at 08:40:42 UTC, lili wrote:
Hi:
I want implementation Lua on D, I find that a PEG parser
https://github.com/PhilippeSigaud/Pegged
why do not use BNF parser. Is PEG better than BNF?
The readme has a link to the reference article:
https://bford.info/pub/lang/peg
Which says in the abstract:
The power of generative grammars to express ambiguity is
crucial to their original purpose of modelling natural
languages, but this very power makes it unnecessarily difficult
both to express and to parse machine-oriented languages using
CFGs. Parsing Expression Grammars (PEGs) provide an
alternative, recognition-based formal foundation for describing
machine-oriented syntax, which solves the ambiguity problem by
not introducing ambiguity in the first place.