www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Wasn't someone trying to work on a C backend for DMD?

reply Chad J <chadjoan __spam.is.bad__gmail.com> writes:
I've googled for it a bit and searched over newsgroup messages but I 
can't find the post that mentioned this.  I think it might have been 
amidst the discussion of the javascript backend.

I want to download it and try it out.
Apr 28 2012
next sibling parent reply "Nick Sabalausky" <SeeWebsiteToContactMe semitwist.com> writes:
"Chad J" <chadjoan __spam.is.bad__gmail.com> wrote in message 
news:jnhv5n$qe3$1 digitalmars.com...
 I've googled for it a bit and searched over newsgroup messages but I can't 
 find the post that mentioned this.  I think it might have been amidst the 
 discussion of the javascript backend.

 I want to download it and try it out.

MicroD: https://github.com/yebblies/dmd/tree/microd D->JS thread mentioning it in a few places: http://forum.dlang.org/thread/yfmgvgprfpiquakiyjlk forum.dlang.org?page=1
Apr 28 2012
next sibling parent "Daniel Murphy" <yebblies nospamgmail.com> writes:
"Nick Sabalausky" <SeeWebsiteToContactMe semitwist.com> wrote in message 
news:jnicul$1eka$1 digitalmars.com...
 "Chad J" <chadjoan __spam.is.bad__gmail.com> wrote in message 
 news:jnhv5n$qe3$1 digitalmars.com...
 I've googled for it a bit and searched over newsgroup messages but I 
 can't find the post that mentioned this.  I think it might have been 
 amidst the discussion of the javascript backend.

 I want to download it and try it out.

MicroD: https://github.com/yebblies/dmd/tree/microd D->JS thread mentioning it in a few places: http://forum.dlang.org/thread/yfmgvgprfpiquakiyjlk forum.dlang.org?page=1

The original thread is here: http://forum.dlang.org/post/icmsymtoqgkcsxwlpqgj dfeed.kimsufi.thecybershadow.net Adam's javascript backend is based on this branch, and has had quite a bit more work done on it. It is much more of an experiment than a serious backend.
Apr 28 2012
prev sibling parent reply Chad J <chadjoan __spam.is.bad__gmail.com> writes:
On 04/28/2012 11:36 PM, Nick Sabalausky wrote:
 "Chad J"<chadjoan __spam.is.bad__gmail.com>  wrote in message
 news:jnhv5n$qe3$1 digitalmars.com...
 I've googled for it a bit and searched over newsgroup messages but I can't
 find the post that mentioned this.  I think it might have been amidst the
 discussion of the javascript backend.

 I want to download it and try it out.

MicroD: https://github.com/yebblies/dmd/tree/microd D->JS thread mentioning it in a few places: http://forum.dlang.org/thread/yfmgvgprfpiquakiyjlk forum.dlang.org?page=1

Hey, thanks! Bummer, no commits in the last 3 months or so. At any rate, I almost wonder if I can compile the output C code on the OpenVMS system at work. I have a project in C I work on from time to time, but it's an uncomfortable (to say the least) environment to work with. There is stuff like this: http://h30499.www3.hp.com/t5/Languages-and-Scripting/How-do-I-get-C-program-tracebacks-to-print-SOURCE-line-numbers/td-p/5570015 If I had DMD with C-backend at my disposal, then maybe I could instrument it with a calling convention that gives me exception handling and proper debug information. Then I'd also get arrays and various other really nice D features, even with just the basics. I wouldn't bother getting the GC to work, but it'd make me consider implementing some kind of reference counting. Even without ref counting I'd have way more at that point than what I have currently with straight C code. And if I /could/ get reference counting, and if the backend were solid enough, then the thing could probably be used for writing games. I'd have the ability to output extremely portable C code to pretty much any target except the web, and there's the JS backend for that. Very enticing! I wonder what it would take to get this sort of thing merged into mainline.
Apr 28 2012
parent reply "Daniel Murphy" <yebblies nospamgmail.com> writes:
"Chad J" <chadjoan __spam.is.bad__gmail.com> wrote in message 
news:jniju1$1pf7$1 digitalmars.com...
 Bummer, no commits in the last 3 months or so.

It was never a serious project unfortunately, just an experiment.
 At any rate, I almost wonder if I can compile the output C code on the 
 OpenVMS system at work.  I have a project in C I work on from time to 
 time, but it's an uncomfortable (to say the least) environment to work 
 with.  There is stuff like this:
 http://h30499.www3.hp.com/t5/Languages-and-Scripting/How-do-I-get-C-program-tracebacks-to-print-SOURCE-line-numbers/td-p/5570015
 If I had DMD with C-backend at my disposal, then maybe I could instrument 
 it with a calling convention that gives me exception handling and proper 
 debug information.  Then I'd also get arrays and various other really nice 
 D features, even with just the basics.  I wouldn't bother getting the GC 
 to work, but it'd make me consider implementing some kind of reference 
 counting.  Even without ref counting I'd have way more at that point than 
 what I have currently with straight C code.

 And if I /could/ get reference counting, and if the backend were solid 
 enough, then the thing could probably be used for writing games.  I'd have 
 the ability to output extremely portable C code to pretty much any target 
 except the web, and there's the JS backend for that.  Very enticing!

It is a loooong way from being able to do that. Your best bet is probably to try and configure gdc or ldc to output c or compiled code for your platform. Completing MicroD would require porting most of druntime as well.
 I wonder what it would take to get this sort of thing merged into 
 mainline.

A huge amount of work.
Apr 28 2012
next sibling parent Chad J <chadjoan __spam.is.bad__gmail.com> writes:
On 04/29/2012 01:53 AM, Daniel Murphy wrote:
 "Chad J"<chadjoan __spam.is.bad__gmail.com>  wrote in message
 news:jniju1$1pf7$1 digitalmars.com...
 Bummer, no commits in the last 3 months or so.

It was never a serious project unfortunately, just an experiment.
 At any rate, I almost wonder if I can compile the output C code on the
 OpenVMS system at work.  I have a project in C I work on from time to
 time, but it's an uncomfortable (to say the least) environment to work
 with.  There is stuff like this:
 http://h30499.www3.hp.com/t5/Languages-and-Scripting/How-do-I-get-C-program-tracebacks-to-print-SOURCE-line-numbers/td-p/5570015
 If I had DMD with C-backend at my disposal, then maybe I could instrument
 it with a calling convention that gives me exception handling and proper
 debug information.  Then I'd also get arrays and various other really nice
 D features, even with just the basics.  I wouldn't bother getting the GC
 to work, but it'd make me consider implementing some kind of reference
 counting.  Even without ref counting I'd have way more at that point than
 what I have currently with straight C code.

 And if I /could/ get reference counting, and if the backend were solid
 enough, then the thing could probably be used for writing games.  I'd have
 the ability to output extremely portable C code to pretty much any target
 except the web, and there's the JS backend for that.  Very enticing!

It is a loooong way from being able to do that. Your best bet is probably to try and configure gdc or ldc to output c or compiled code for your platform. Completing MicroD would require porting most of druntime as well.
 I wonder what it would take to get this sort of thing merged into
 mainline.

A huge amount of work.

I was afraid you might say that. Thanks for the input!
Apr 28 2012
prev sibling parent reply "Nick Sabalausky" <SeeWebsiteToContactMe semitwist.com> writes:
"Daniel Murphy" <yebblies nospamgmail.com> wrote in message 
news:jnil1c$1qv8$1 digitalmars.com...
 "Chad J" <chadjoan __spam.is.bad__gmail.com> wrote in message 
 news:jniju1$1pf7$1 digitalmars.com...
 Bummer, no commits in the last 3 months or so.

It was never a serious project unfortunately, just an experiment.

After having done the experiment, do you feel it's a promising approach? Are there things you figure would be better done differently?
Apr 28 2012
parent "Daniel Murphy" <yebblies nospamgmail.com> writes:
"Nick Sabalausky" <SeeWebsiteToContactMe semitwist.com> wrote in message 
news:jnimdk$1t1t$1 digitalmars.com...
 It was never a serious project unfortunately, just an experiment.

After having done the experiment, do you feel it's a promising approach? Are there things you figure would be better done differently?

I actually found it a lot easier than expected. Most of the constructs that survive to the glue layer are c constructs, which naturally map very well to c code. Writing the actual code is quite straightforward, it's very similar to what is done in 'toCBuffer' for di generation. I never hit a roadblock, so it should be easy for someone else to continue on from there (as Adam has). That said, reconfiguring gdc or ldc to output c (or to target the intended platform) is probably a better idea than writing a new c backend. Either way, druntime needs to be ported.
Apr 28 2012
prev sibling parent reply "bls" <bls orange.fr> writes:
On Saturday, 28 April 2012 at 23:40:39 UTC, Chad J wrote:
 I've googled for it a bit and searched over newsgroup messages 
 but I can't find the post that mentioned this.  I think it 
 might have been amidst the discussion of the javascript backend.

 I want to download it and try it out.

http://www.dsource.org/projects/tdc
Apr 28 2012
parent Chad J <chadjoan __spam.is.bad__gmail.com> writes:
On 04/29/2012 01:02 AM, bls wrote:
 On Saturday, 28 April 2012 at 23:40:39 UTC, Chad J wrote:
 I've googled for it a bit and searched over newsgroup messages but I
 can't find the post that mentioned this. I think it might have been
 amidst the discussion of the javascript backend.

 I want to download it and try it out.

http://www.dsource.org/projects/tdc

Interesting! I'd forgotten about that (or possibly not heard of it?). 5 years old though. *sigh*, I wish stuff like this had taken off much earlier.
Apr 28 2012