November 09, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to nazriel | On 11/9/13 9:14 AM, nazriel wrote: > On Thursday, 18 July 2013 at 01:21:44 UTC, Chad Joan wrote: >> I'd like to present my vision for a new D compiler. I call it xdc, a >> loose abbreviation for "Cross D Compiler" (if confused, see >> ... >> Thank you for reading. > > I think C backend is a good idea. I think C is not a good back-end language. Other backend generators usually have a white paper explaining why... http://www.cminusminus.org/ Andrei |
November 10, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | "Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> wrote in message news:l5madp$1p24$1@digitalmars.com... > On 11/9/13 9:14 AM, nazriel wrote: >> On Thursday, 18 July 2013 at 01:21:44 UTC, Chad Joan wrote: >>> I'd like to present my vision for a new D compiler. I call it xdc, a >>> loose abbreviation for "Cross D Compiler" (if confused, see >>> ... >>> Thank you for reading. >> >> I think C backend is a good idea. > > I think C is not a good back-end language. Other backend generators usually have a white paper explaining why... http://www.cminusminus.org/ > > Andrei > > That is true in general, but D actually maps quite well onto C. I did some work on creating a C backend a while back, and it worked quite well. However - most of the work is in creating a runtime that will work correctly on the target platform. If your desired target is anything that llvm or gcc supports, I would recommend using ldc/gdc instead of doing it all from scratch. |
November 10, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Sunday, 10 November 2013 at 04:54:18 UTC, Daniel Murphy wrote:
> That is true in general, but D actually maps quite well onto C.
>
> I did some work on creating a C backend a while back, and it worked quite
> well.
>
Out of curiosity, how do you handle exceptions ?
|
November 10, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | "deadalnix" <deadalnix@gmail.com> wrote in message news:juoauplfttovsmbrafzh@forum.dlang.org... > On Sunday, 10 November 2013 at 04:54:18 UTC, Daniel Murphy wrote: >> That is true in general, but D actually maps quite well onto C. >> >> I did some work on creating a C backend a while back, and it worked quite well. >> > > Out of curiosity, how do you handle exceptions ? I didn't. This was focussed on a subset suitable for microcontrollers. I would probably emit C++ instead if exceptions were required. |
November 10, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On 11/9/13 9:37 PM, Daniel Murphy wrote:
> "deadalnix" <deadalnix@gmail.com> wrote in message
> news:juoauplfttovsmbrafzh@forum.dlang.org...
>> On Sunday, 10 November 2013 at 04:54:18 UTC, Daniel Murphy wrote:
>>> That is true in general, but D actually maps quite well onto C.
>>>
>>> I did some work on creating a C backend a while back, and it worked quite
>>> well.
>>>
>>
>> Out of curiosity, how do you handle exceptions ?
>
> I didn't. This was focussed on a subset suitable for microcontrollers. I
> would probably emit C++ instead if exceptions were required.
That doesn't quite rhyme with C being a good backend language :o).
Andrei
|
November 10, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 11/9/2013 9:27 PM, deadalnix wrote:
> On Sunday, 10 November 2013 at 04:54:18 UTC, Daniel Murphy wrote:
>> That is true in general, but D actually maps quite well onto C.
>>
>> I did some work on creating a C backend a while back, and it worked quite
>> well.
>>
>
> Out of curiosity, how do you handle exceptions ?
Exceptions is one big problem. Another is COMDATs - C compilers don't emit them. COMDATs are needed to support templates (they remove duplicate instances).
And TLS.
|
November 10, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy Attachments:
| On 10 November 2013 04:54, Daniel Murphy <yebblies@nospamgmail.com> wrote: > "Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> wrote in message news:l5madp$1p24$1@digitalmars.com... > > On 11/9/13 9:14 AM, nazriel wrote: > >> On Thursday, 18 July 2013 at 01:21:44 UTC, Chad Joan wrote: > >>> I'd like to present my vision for a new D compiler. I call it xdc, a > >>> loose abbreviation for "Cross D Compiler" (if confused, see > >>> ... > >>> Thank you for reading. > >> > >> I think C backend is a good idea. > > > > I think C is not a good back-end language. Other backend generators usually have a white paper explaining why... http://www.cminusminus.org/ > > > > Andrei > > > > > > That is true in general, but D actually maps quite well onto C. > > I did some work on creating a C backend a while back, and it worked quite well. > > However - most of the work is in creating a runtime that will work > correctly > on the target platform. If your desired target is anything that llvm or > gcc > supports, I would recommend using ldc/gdc instead of doing it all from > scratch. > > Especially gdc. Cross-platform support needs all the love it can get. ;-) -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0'; |
November 10, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | "Andrei Alexandrescu" <SeeWebsiteForEmail@erdani.org> wrote in message news:l5n7iq$2op2$1@digitalmars.com... > On 11/9/13 9:37 PM, Daniel Murphy wrote: >> "deadalnix" <deadalnix@gmail.com> wrote in message news:juoauplfttovsmbrafzh@forum.dlang.org... >>> On Sunday, 10 November 2013 at 04:54:18 UTC, Daniel Murphy wrote: >>>> That is true in general, but D actually maps quite well onto C. >>>> >>>> I did some work on creating a C backend a while back, and it worked >>>> quite >>>> well. >>>> >>> >>> Out of curiosity, how do you handle exceptions ? >> >> I didn't. This was focussed on a subset suitable for microcontrollers. >> I >> would probably emit C++ instead if exceptions were required. > > That doesn't quite rhyme with C being a good backend language :o). > > Andrei > I guess it's not for the full language, but if you can't use gdc or llvm, chances are your platform is too constrained to use exceptions. I don't mean C is capable of representing everything, but it can handle a large and useful subset. |
November 11, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chad Joan | On Friday, 19 July 2013 at 13:38:12 UTC, Chad Joan wrote:
> I think a C backend would get us farther than an LLVM backend.
Hi,
LLVM has a C++ backend in the git tree. The old C backend is still maintained outside the git tree (search the dev mailing list for an url).
So if you like C-output, you can start with LDC today. For sure, you have to port druntime to this new environemnt...
Regards,
Kai
|
November 11, 2013 Re: xdc: A hypothetical D cross-compiler and AST manipulation tool. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Chad Joan | I will definitely back up this project on kickstarter, if the mentioned Java backend is going to be somewhere at the top priorities. Being able to target JVM is extremely important to me. Before you do the kickstarter please make a list of features that you plan to be in XDC after the release, and when do you plan the release to happen. |
Copyright © 1999-2021 by the D Language Foundation