Anyone interested in a working grammar for D?

kellywilson at nowhere.com kellywilson at nowhere.com
Thu Feb 23 14:39:57 PST 2006


In article <Pine.LNX.4.64.0602231405380.30259 at bellevue.puremagic.com>, Brad
Roberts says...
>Outside academic interest, have you considered using dmd's front end 
>directly?  It is freely available (by several definitions).  Since it's 
>the 'one true source' that defines the language in practice, re-use of it 
>would make for a much more accurate tool to build on top of.

Mostly academic interest here Brad. For future work I need a complete AST in a
managable (and familiar) format.

>I don't mean to downplay your effort.  Rewriting something can often be 
>both fun and educational.  Sometimes it even results in something truely 
>better.  But it is, as you've found, a lot of effort to get to be perfect.

Extremely fun and not perfect, as you say. But that is beside the point, for me.

>Walter releases the source to the front end in large part to help 
>eliminate the duplication of effort.  It's what gdc uses to build the d 
>front end for gcc.  The bulk of the now code in gdc is the glue layer 
>between dmd's frontend and gcc's IR.  The rest is the runtime support to 
>work with gcc and linux's runtime (exceptions being a good example).

Understood. The problem here is that I have looked at the "glue" and it is not
what I would call "easily readable" for someone unfamiliar with gcc internals. I
also have seen several attempts at producing a grammar in the past (Charlie,
Ivan and someone with an ANTLR grammar but I can't remember his name off hand).
Just wanted to make one available, if some people wanted it (I also wished to
see Elkhound a little more in depth). 

Ivan emailed me within minutes stating that he would like to see the grammar, as
he was about to revisit the problem....thus eliminating some duplication of
effort ;)

By the way, if there is a free dmd compiler then why did someone go through the
effort of gluing the gcc backend on? I think "there is always more than one way
to skin a cat" ;)

Thanks,
K.Wilson





More information about the Digitalmars-d mailing list