Why Dlang use parsing expression grammar (PEG) parser not BNF?

user4567 user4567 at 1234.te
Fri Nov 1 23:39:34 UTC 2019


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?

IIRC the PEG for D is not complete. You have an EBNF here 
https://libdparse.dlang.io/grammar.html, which you can use to 
feed a library generating the parser. Note however that the 
lexical part is missing (so the regex-like for numbers, literals, 
etc.).


More information about the Digitalmars-d-learn mailing list