Any usable parsers for D2 around?

Justin C Calvarese jccalvarese at gmail.com
Thu Oct 28 11:47:11 PDT 2010


== Quote from Bruno Medeiros (brunodomedeiros+spam at com.gmail)'s article
> I so wished there was a ANTLR based parser for D, or at least an ANTLR
> grammar.

I remember seeing some talk in the D newsgroups over the years about the desire for an ANTLR file
for D. After a quick search of Wiki4D, I found this:
http://www.prowiki.org/wiki4d/wiki.cgi?GrammarParsers#ANTLR-D

That lead me to the ANLTR-D project at dsource.org.

This was the most useful-looking file that I found in SVN:
http://www.dsource.org/projects/antlrd/browser/toys/v3d/parsed.g:

/** A parser for D v1.
  * It's a little loose in parsing declarations, as correctly discerning
  * a function header is complicated, and it's a bit smarter than DMD in a few
  * other places. It can pick out some expression/declaration ambiguities and
  * mark them as such, and it allows mixins to begin expressions.
  * Ambiguities between types and expressions are not caught, and always default
  * to types.
  */

(I don't know have any idea whether it's too out-of-date to be useful or whether something else
might be wrong with it.)

jcc7


More information about the Digitalmars-d-learn mailing list