DMD source overview?

Denis Koroskin 2korden at gmail.com
Tue Sep 14 13:17:06 PDT 2010


On Tue, 14 Sep 2010 23:33:37 +0400, Nick Sabalausky <a at a.a> wrote:

> "Eldar Insafutdinov" <e.insafutdinov at gmail.com> wrote in message
> news:i6ni0q$31jt$1 at digitalmars.com...
>> Hi Nick!
>>
>> If you are going to replace dmd's backend, you might want to have a look
>> at ddmd,
>> as we have plans to make other backends for it. And of course it is much
>> more
>> pleasant to work with D rather than C++!
>
> Actually I was thinking of doing as much of my backend as possible in D
> anyway since D and C are supposed to be link-compatible (and since I got
> really fed up with C/C++ a long time ago). Of course, dmd is C++, not C,  
> so
> I figure I might need to add a C-based bridge-to-my-backend in the
> front-end...unless dmd sticks to the subset of C++ that D2 supports  
> linking
> with? (Anyone know if that's the case?)
>

dmd2 supports some of the C++, but it is mostly limited to free functions  
and virtual member functions. D also has no direct mapping for C/C++  
"long" type so some proxy functions might be required. Better than  
nothing, anyway.

> But you do raise a good point. What's the current state of ddmd's  
> front-end?

It's at 2.039 atm, and it improves rapidly, e.g. it was at 2.032 about 3  
weeks ago. I don't really think you need the most up to date version to  
begin with.

> What I have in mind is to just rip out dmd's current backend stuff  
> entirely,
> maybe even including the toObjFile and toIR methods, or at least big  
> chunks
> of them, and replace it all with a PHP-generator. (Yea...I'm fairly
> determined to be able to do as much of my web dev as possible in D.) So
> depending on the current level of ddmd's progress, I'm wondering if it  
> might
> be more practical to just stick with my orignal plan of using dmd and  
> then
> switch over to ddmd once ddmd is ready. Although, one benefit of using  
> dmd
> is it would likely make it quicker and easier to merge in changes from  
> new
> dmd releases.
>
>

I would recommend against heavy modification of the original code (e.g.  
getting rid of toIR/toObjFile, be it dmd or ddmd). Use external visitors  
if possible.

Why would you want to generate PHP anyway? There are FastCGI libraries  
available for D, and there isn't much that D is missing and PHP has  
anyway. Everything else is implementable as a library (and contributable  
to Phobos! ;)


More information about the Digitalmars-d mailing list