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

Martin Nowak dawg at dawgfoto.de
Mon Oct 24 00:47:06 PDT 2011


On Sun, 23 Oct 2011 21:56:34 +0200, Gor Gyolchanyan  
<gor.f.gyolchanyan at gmail.com> wrote:

> Yes. a general-purpose parsing tool would be great.
> I don't think, that porting DMD's front-end is a good idea, because
> it's far from being generic or modular.
> We're gonna have to start from scratch.
>
> Optionally, it would be really great to make it CTFE-able, so it could
> be used to provide a complete compile-time reflection.
>
The issue being, that most approaches to generic parsing
suffer from unspecific error handling, bad integration with client code
and the need for dynamic typing in the parse tree.
Language integrated approaches as boost::spirit mostly fail for
anything but simple and regular parsing (e.g. CSV).

My personal conclusion is that I will waste no more time on trying to use  
or write
general parsers, it's much more pleasant to write recursive decent parsers.

martin

> On Sun, Oct 23, 2011 at 10:40 PM, Jonathan M Davis <jmdavisProg at gmx.com>  
> wrote:
>> On Sunday, October 23, 2011 22:27:17 Gor Gyolchanyan wrote:
>>> 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.
>>
>> The two proposed approaches at the moment are to port dmd's frontend to  
>> D for
>> Phobos and to write a template-based generative, generic solution. The  
>> first
>> would obviously be D-specific. The second would be for _any_ language.  
>> In
>> either case, any solution needs to be broken up into a lexer, parser,  
>> etc. in
>> manner which allows you to use only the pieces that you need for a  
>> particular
>> application.
>>
>> And so unless you're going with the "port dmd frontend to D" approach,  
>> any
>> solution really needs to be generic and not D-specific. Naturally, we'll
>> provied whatever's needed to generate the D lexer, parser, etc. as part  
>> of
>> Phobos, but the lexer, paresr, etc. need to be generic and generative  
>> rather
>> than D-specfiic.
>>
>> http://www.mail-archive.com/digitalmars-d@puremagic.com/msg40358.html
>>
>> - Jonathan M Davis


More information about the Digitalmars-d mailing list