On 06/13/2010 03:15 PM, BCS wrote:
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.


In the past, Walter has expressed a dislike of parser generators. I doubt you can get him to change his mind on that one, especially since most parser generators won't be able to handle D anyways, and I doubt any of them will be able to handle D efficiently (what are they called - GLR parser generators? Don't know about these).

As far as analysing parse.c goes, how much effort is it going to take to figure out what

while(1)
  switch(token.value){
    case x:
      parseThis();
      continue;
    case y:
      parseThat();
      break;
  }
  break;
}

should look like in a grammar?

Counterproposal: why don't we just fix the grammar?


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.

I would very much like to see the entire grammar in one place. I can't tell you how obnoxious it is to search through the entire site to find one production

And as always, apologies for being a pessimist.

Reply via email to