[spec] Looking for a write-up on the grammar notation

Dibyendu Majumdar d.majumdar at gmail.com
Fri May 17 12:15:53 UTC 2019


On Thursday, 16 May 2019 at 20:23:39 UTC, Max Haughton wrote:
> The D's *grammar* is almost context free

Hi, Could you explain this further?

>
> I'm not sure what you mean for #3, but D can be parsed by 
> parser generators 
> (https://github.com/PhilippeSigaud/Pegged/blob/master/pegged/examples/dgrammar.d is close(?) to a D grammar for pegged).  The Source for the actual parser in dmd is recursive descent and therefore basically follows the grammar rules (In the source)

Thank you for the link. I meant where one could use the D Grammar 
and literally translate it to a system like yacc or ANTLR and get 
a working parser. For instance in C, you can't do that I believe 
because you need a symbol table to resolve typedefs.

Regards



More information about the Digitalmars-d mailing list