D grammar

Brian Schott via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 13 14:47:34 PDT 2016


On Sunday, 12 June 2016 at 06:45:58 UTC, Russel Winder wrote:
> I should know this, but…
>
> Is there an official D grammar (EBNF or otherwise) or is the 
> language
> defined by the DMD parser?
>
> I am looking to continue Kingsley's DLanguage IntelliJ IDEA 
> plugin and for that it is necessary to have a grammar 
> specification. Kingsley has been working on one, but there may 
> be differences between it and 2.071. Given the compilers and 
> all the supporting tools either there is one language 
> specification they all work with or there is a lot of 
> fragmented viewpoints as to what D actually is. I am hoping the 
> latter is not the case.

If you attempt to give the language specification to a parser 
generator like ANTLR you will quickly discover that the spec is 
reverse-engineered from the implementation, and that the spec is 
ambiguous in many places. The spec, being derived from the 
implementation is not really aware of the existence of the 
ambiguities, and doesn't say how to resolve them.


More information about the Digitalmars-d mailing list