www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D compiler front end in Phobos (was: syntax definition language)

cool!
I really _REALY_ want to get a working D front-end into Phobos.
preferably during my lifetime.
Obviously there's some work already done in this area.
I'd like us to chip in and discuss this in-depth and come up with a
plan to do this.
AFAIK everyone was in favor of a front-end as a library solution.

On Sun, Oct 23, 2011 at 9:19 PM, Martin Nowak <dawg dawgfoto.de> wrote:
 On Sun, 23 Oct 2011 15:10:08 +0200, Gor Gyolchanyan
 <gor.f.gyolchanyan gmail.com> wrote:

 Anyway, I'm writing a general-purpose parser base, so i won't need it for
 now.
 And when i do, I'd like to have a correct grammar definition, so i can
 feed it to my parser.
 Who should i ask to ensure it's correctness?

 Once I'm done, I'll send a pull request for something around
 "etc.dcfe" for "D compiler front end".
 It won't be perfect, of course, but it will be a start, from which the
 front-end would be gradually developed.
 I wanna at least have an AST parser by the time i make the pull request.

 On Sun, Oct 23, 2011 at 5:01 PM, Timon Gehr <timon.gehr gmx.ch> wrote:
 On 10/23/2011 02:16 PM, Gor Gyolchanyan wrote:
 Yeah, i know about EBNF, but it uses completely different syntax.
 I'm really excited about having a standard D compiler front-end as a
 library solution, so i though it would be best to parse the syntax
 from the syntax definition of dpl.org

That can currently not be done. The syntax specification on dpl.org is out of date and contains many errors and inaccuracies. (at least it was that way the last time I checked)


I've written a fast and pretty complete D lexer (https://gist.github.com/1262321). It is based on a generic lexer component which will generate efficient matching functions at compile time (https://gist.github.com/1255439). I think there are still some compiler bugs to be sorted out so you won't be able to compile it out of the box. martin

Oct 23 2011