[spec] Looking for a write-up on the grammar notation
Max Haughton
maxhaton at gmail.com
Thu May 16 20:23:39 UTC 2019
On Thursday, 16 May 2019 at 18:48:15 UTC, Dibyendu Majumdar wrote:
> Some questions:
>
> 1. Is the grammar complete?
> 2. Is it unambiguous?
> 3. Can it be directly converted to a parser?
>
> Sorry I am not an expert in this so apologies if above is
> stupid.
>
> Regards
I'm very rusty with the theory behind grammars:
the grammar is complete for the core language (There are some
DIPs that change things, but AFAIK they're either within the
existing grammar or require no modification).
The D's *grammar* is almost context free
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)
More information about the Digitalmars-d
mailing list