On 13 March 2012 16:02, bcs <b...@example.com> wrote: > On 03/12/2012 03:17 AM, Alix Pexton wrote: >> >> On 11/03/2012 16:49, Philippe Sigaud wrote: >>> >>> Hello, >>> >>> I'm looking for a D grammar in (E)BNF form. Did any of you write >>> something like that or do you think I can use the grammar parts on >>> dlang.org? >>> >>> >>> I remember different threads on this subject and saw the docs being >>> updated regularly on github, but my google-fu is weak today. >>> >> >> Rainer Schuetze pulled all the grammar out of the docs and fixed them up >> a while back as part of his work on Visual D. Its not in straight EBNF >> and it may not be 100% up to date, but it may be a good place to start. >> >> http://www.dsource.org/projects/visuald/wiki/GrammarComparison >> >> I hope that is of some use! >> >> A... > > > IIRC the grammar in the docs has tended to be out of date one in a while. > I'd love to see the source for the grammar rules become the parser source > (either generating the parser from a grammar, generating a grammar from the > parser or embed the documentation of each grammar rule in the comments next > to the code that implements it).
I agree, automatic generation of the grammar rules would be incredibly useful for D tools. It doesn't necessarily have to be in a human-readable format, or even in a specific grammar format, just up to date. We can always have something to convert it into a specific format for whatever we are doing. We are programmers after all. -- James Miller