D parser in tango or phobos

Bruce Adams tortoise_74 at yeah.who.co.uk
Sat Sep 6 06:06:17 PDT 2008


On Wed, 03 Sep 2008 16:33:11 +0100, davidl <davidl at 126.com> wrote:

> 在 Wed, 03 Sep 2008 21:51:47 +0800,Knud Soerensen  
> <4tuu4k002 at sneakemail.com> 写道:
>
>> davidl wrote:
>>> 在 Tue, 02 Sep 2008 15:37:38 +0800,Knud Soerensen
>>> <4tuu4k002 at sneakemail.com> 写道:
>>>
>>>> Hi
>>>>
>>>> When building tools for manipulating d code, you practical always  
>>>> need a
>>>> parser.
>>>>
>>>> So, why not include a d parser as part of the runtime library,
>>>> in that way the it is much easy to write code tools.
>>>>
>>>> dmd itself might even use the same parser, which
>>>> will insure that the parser support the latest version of d and it  
>>>> will
>>>> be a nice start for a incremental d compiler.
>>>>
>>>>
>>>
>>> It's not easy to have a complete working bug free parser.
>>> dsource.org/projects/dparser
>>>
>> I know this is why I made the suggestion.
>>
>> The idea is that tool developer should have a stable platform
>> base his tool upon.
>>
>> Such he doesn't have to patch the parser every time a new version of dmd
>> hits the web.
>>
>>
>
> What you're asking is simply impossible. It's equivalent to why we don't  
> have a bug-free
> frontend.
>
Its not impossible just difficult.
One of the first questions some people ask when
told about a new language is "what is it written in?"
If its not written in itself they ask why. If the answer is not compelling  
they
may walk away.
If D ever intends to supplant C as the main systems programming language
it will have to get over this hurdle.
A problem is that the language is itself not that stable. You could write  
a D
compiler in D1.0 but why bother when it will soon be obsolete. Writing a D  
compiler in
D2.0 is a moving target which makes it harder to hit but to quote full  
metal jacket
"you've just got to lead them a bit".

Python has a python parser written in python. The main interpreter is  
written in C for portability.
That is a good reason and the same reason applies for D. Why in this day  
and age C++ isn't considered
portable by most such project is beyond me.
I particularly like gcc's approach of bootstraping itself to full  
functionality. Its a shame the insides
are so gnarly.

Regards,

Bruce.




More information about the Digitalmars-d mailing list