Re: Will it be possible to write a GCC frontend in D?

2022-02-23 Thread rempas via Digitalmars-d-learn
On Wednesday, 23 February 2022 at 21:33:00 UTC, Adam D Ruppe 
wrote:


There is no branch, it is just part of the upstream mainline. 
see:


https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=gcc/d/dmd;h=454baa71a0d270fb891acdda6fd0215a3d6cb588;hb=HEAD


Oh, this is what I mean by saying "branch" so my mistake. Thanks 
for the info!


and yeah it is extern(C++). importC isn't going to be helpful, 
but still, gdc proves you can make a gcc frontend in d.


Yeah, If you put it that way. Tbh, I already knew it was possible 
to do is this way because I know GDC's frontend was written in D. 
However, I was wondering if we can have C bindings but it seems 
that's not the case.


Re: Will it be possible to write a GCC frontend in D?

2022-02-23 Thread Adam D Ruppe via Digitalmars-d-learn

On Wednesday, 23 February 2022 at 20:42:10 UTC, rempas wrote:

Do you know where is the updated GDC branch btw?


There is no branch, it is just part of the upstream mainline. see:

https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=gcc/d/dmd;h=454baa71a0d270fb891acdda6fd0215a3d6cb588;hb=HEAD

and yeah it is extern(C++). importC isn't going to be helpful, 
but still, gdc proves you can make a gcc frontend in d.


Re: Will it be possible to write a GCC frontend in D?

2022-02-23 Thread rempas via Digitalmars-d-learn
On Wednesday, 23 February 2022 at 20:19:04 UTC, Adam D Ruppe 
wrote:


I should hope so, otherwise gdc wouldn't exist, yet it does.


[extern 
(C++)](https://github.com/D-Programming-GDC/gdc/tree/master/gcc/d/dmd) and manually creating the decorations. At least that's my understanding of browsing the source and that was until 2018. Do you know where is the updated GDC branch btw?


Re: Will it be possible to write a GCC frontend in D?

2022-02-23 Thread rempas via Digitalmars-d-learn

On Wednesday, 23 February 2022 at 20:06:58 UTC, bachmeier wrote:


Not sure if this is the same thing (a link would have helped) 
but [this is done in 
C](https://www.cs.usfca.edu/~galles/compilerdesign/C/csupport.html)


Thank you! However, one things that I didn't mentioned is that 
GCC was once written in C but now it is written in C++ so the 
date this was created matters.


Re: Will it be possible to write a GCC frontend in D?

2022-02-23 Thread Adam D Ruppe via Digitalmars-d-learn

On Wednesday, 23 February 2022 at 19:58:45 UTC, rempas wrote:

Will it be possible to write a GCC frontend in D?


I should hope so, otherwise gdc wouldn't exist, yet it does.


Re: Will it be possible to write a GCC frontend in D?

2022-02-23 Thread bachmeier via Digitalmars-d-learn

On Wednesday, 23 February 2022 at 19:58:45 UTC, rempas wrote:
I'm using a book called "modern compiler design (version 2)" to 
learn how to create compiler and I thought about learning and 
applying this knowledge on writing a GCC frontend just for fun 
to see where this gets me. However, I've seen some tutorials 
and I've seen people doing it in C++. Now, I want to do it in D 
(of course!). My problem is that I don't if the headers are 
using C++ features because If this is possible then I won't be 
able to use ImportC to "automatically" get bindings to use in 
D. Any ideas?


Not sure if this is the same thing (a link would have helped) but 
[this is done in 
C](https://www.cs.usfca.edu/~galles/compilerdesign/C/csupport.html)