On Friday, 12 October 2012 at 14:41:12 UTC, Russel Winder wrote:
On Fri, 2012-10-12 at 15:11 +0200, Aziz K. wrote:
Hi,

I can give you three options to choose from.

There's the official grammar (don't know what the form is called):

http://dlang.org/declaration.html

A Parser Expression Grammar (PEG):

https://github.com/PhilippeSigaud/Pegged/blob/master/pegged/examples/dparser.d

The source code comments in my project using a pseudo-BNF format. They shouldn't be too hard to decipher, but keep in mind that they're not 100% complete and exact:

http://dl.dropbox.com/u/17101773/next/2/dil/doc/dil.parser.Parser.html#Parser.parseModuleDecl

I think the official grammar rules in, let's call it K&R grammar, is the only choice here. Rather than scrape from the website is there a file in the Git repository with this grammar rule set? If so then a small program in say, Python ;-), would give a EBNF grammar representation fairly straightforwardly – read grammar ruleset, construct tree representing the ruleset, run visitor over tree to generate EBNF.

My grammar knowledge is a bit rusty, but isn't EBNF only possible for LR(K) languages?

Is is possible for D?

--
Paulo

Reply via email to