Right now we have two semi-official definitions of the D grammar; the docs (that are wrong) and the parser source (that is effectively unreadable by most people). I would like to propose a solution to this problem: eliminate one of them and derive it from the other.

I know this will be hard to do but it can be done incrementally with each step making improvements over the last.

The first thing to do is put all of the description of the grammar in the docs into one place. If the literal text of each production is replace with a macro reference then the definitions of these macros can be put into a single file and expanded everywhere. The incremental improvement here is that having the grammar in one place by it's self will make it easier to check.

From here there are several things that can be done:

- copy the grammar rule macros into the parser source where they will stay more up to date.
- write a tool to generate the rules from the parser source.
- write a tool to generate the parser source from the rules.

I'd be willing to do that first step if I got any (semi)official indication that it would be used.

--
... <IXOYE><



Reply via email to