Jump to page: 1 2
Thread overview
D compiler written in D
Feb 03, 2004
Stephan Wienczny
Feb 03, 2004
Walter
Feb 05, 2004
Stephan Wienczny
Feb 06, 2004
Marcel Meyer
Feb 06, 2004
Stephan Wienczny
Feb 06, 2004
Marcel Meyer
Feb 07, 2004
Stephan Wienczny
Feb 07, 2004
Marcel Meyer
Feb 07, 2004
Stephan Wienczny
Feb 07, 2004
Ilya Minkov
Feb 06, 2004
Ben Hinkle
Feb 06, 2004
Stephan Wienczny
February 03, 2004
Hallo,

the GCC efford will improve D's usability. When I tryed into GCC development, I saw that it has a horrible documentation and design.
On the long run it might be a good idea to write an new open source compiler supporting D using D. I've been starting such a project, but I'd like to talk about some design issues with somebody else. maybe sombody would even joing my project.
What I'd like to do better than GCC:
1. As language indepent tree structure as possible.
2. Making it a real cross-compiler. If I want to use GCC as cross compiler, I've got to recompile GCC. Why do we have dynamic libraries?
3. Making it easier to write and integrate a language frontend.
4. Integrating a compile manager (like make) into the compiler driver to make source easily platform independent.

How I would design such a thing:

My compiler should be modular.

Compiler driver: Managing compile process.
Language frontend: Creating syntax tree.
Optimizer: Doing non platform specific optimisations.
Backend: System specific codegeneator doing system specific optimisation

The syntax-tree can be split into two parts.
The first one are deklarations (like classes) which indirectly result in code (eg. for construction etc.)
and implementations (eg. functions)
In my dreams the tree structure should be albe to represent the complete D syntax as it is a very advanced one. Being able to represent  D's syntax C++, C, maybe Java are not a great problem.

What do you think?

At the end a great praise to Walter for his work.

February 03, 2004
The D front end code would be pretty easy to translate into D, as I tend to write C++ code using 'D style' anyway. Creating a new optimizer and back end is an enormous project, though. Wouldn't it be easier to clean up GCC?


"Stephan Wienczny" <wienczny@web.de> wrote in message news:bvosu7$rf2$1@digitaldaemon.com...
> Hallo,
>
> the GCC efford will improve D's usability. When I tryed into GCC
> development, I saw that it has a horrible documentation and design.
> On the long run it might be a good idea to write an new open source
> compiler supporting D using D. I've been starting such a project, but
> I'd like to talk about some design issues with somebody else. maybe
> sombody would even joing my project.
> What I'd like to do better than GCC:
> 1. As language indepent tree structure as possible.
> 2. Making it a real cross-compiler. If I want to use GCC as cross
> compiler, I've got to recompile GCC. Why do we have dynamic libraries?
> 3. Making it easier to write and integrate a language frontend.
> 4. Integrating a compile manager (like make) into the compiler driver to
> make source easily platform independent.
>
> How I would design such a thing:
>
> My compiler should be modular.
>
> Compiler driver: Managing compile process.
> Language frontend: Creating syntax tree.
> Optimizer: Doing non platform specific optimisations.
> Backend: System specific codegeneator doing system specific optimisation
>
> The syntax-tree can be split into two parts.
> The first one are deklarations (like classes) which indirectly result in
> code (eg. for construction etc.)
> and implementations (eg. functions)
> In my dreams the tree structure should be albe to represent the
> complete D syntax as it is a very advanced one. Being able to represent
>   D's syntax C++, C, maybe Java are not a great problem.
>
> What do you think?
>
> At the end a great praise to Walter for his work.
>


February 05, 2004
Walter wrote:
> The D front end code would be pretty easy to translate into D, as I tend to
> write C++ code using 'D style' anyway. Creating a new optimizer and back end
> is an enormous project, though. Wouldn't it be easier to clean up GCC?

I don't think that it is that easy to persuade the gcc developers to clean GCC
as they are to busy implementing SSA. If you see how hard it is to integrate a new language
frontend into GCC you will see that it has flaws. Flaws I'm trying to cover.

I think its possible to "reuse" GCC code e.g. for the code generators.
When translating to D they should be cleaned.

P.s.: What do you think about SSA? Is it that big hit in optimization the GCC people are saying?

February 06, 2004
Stephan Wienczny wrote:
> On the long run it might be a good idea to write an new open source compiler supporting D using D. I've been starting such a project,

oh man, everytime I think I have found a nice project which I could sell a professor as my "Diplomarbeit" someone else starts it a few days later... Is this annoying ;-) [hey, just to be sure - that was a joke *g*]

Nonetheless, I would like the idea of a DCC - especially if all those conf and "make" thinks are somehow implemented. But do you think this is doable in a senseable time? I'm not yet very deep in compiler builds - so I'm quite naive. But everytime I think "what can be done" I just see sooo much work - just like making a really good GUI-toolkit (more like QT) for D - and then I just keep running away crying ;-).

What's after a GUI-tk? A toolcollection - hmm, DING (DING is not GNU) ;-).
And then a kernel? :-D

However, count on me at least as a "break-my-machine-beta-tester".

Marcel
February 06, 2004
Googling for "GCC rewrite" turns up an interesting thread on the gcc mailing
list
http://gcc.gnu.org/ml/gcc/2001-02/msg01037.html

Basically everyone knows GCC is a mess but it is hard to write a replacement from scratch. Would be nice to see, though.

If you want to be flexible enough to use the native cc compilers you could try to port the DMD front-end source to spit out C code or something. I think Ilya was looking into this approach.

-Ben


February 06, 2004
Ben Hinkle wrote:
> Googling for "GCC rewrite" turns up an interesting thread on the gcc mailing
> list
> http://gcc.gnu.org/ml/gcc/2001-02/msg01037.html
> 
> Basically everyone knows GCC is a mess but it is hard to write a replacement
> from scratch. Would be nice to see, though.
> 
> If you want to be flexible enough to use the native cc compilers you could
> try to port the DMD front-end source to spit out C code or something. I
> think Ilya was looking into this approach.
> 
> -Ben
> 
> 

They know it for years now. 2001...

Have a look at what they say:
http://gcc.gnu.org/ml/gcc/2001-02/msg01042.html
GC, strongly typed... D?


Stephan

February 06, 2004
Marcel Meyer wrote:

> Stephan Wienczny wrote:
> 
>>On the long run it might be a good idea to write an new open source
>>compiler supporting D using D. I've been starting such a project,
> 
> 
> oh man, everytime I think I have found a nice project which I could sell a
> professor as my "Diplomarbeit" someone else starts it a few days later...
> Is this annoying ;-) [hey, just to be sure - that was a joke *g*]
> 
*g*

> Nonetheless, I would like the idea of a DCC - especially if all those conf
> and "make" thinks are somehow implemented. But do you think this is doable
> in a senseable time? I'm not yet very deep in compiler builds - so I'm
> quite naive. But everytime I think "what can be done" I just see sooo much
> work - just like making a really good GUI-toolkit (more like QT) for D -
> and then I just keep running away crying ;-).

The first thing I thought when starting the project was: "There is a lot of work", but I think I overestimated it. The hardest thing is the backend. Do you know some ASM-Guru that could help?
Maybe you want to join in if you have some time.
> 
> What's after a GUI-tk? A toolcollection - hmm, DING (DING is not GNU) ;-).
> And then a kernel? :-D

Who told you my agenda? I'm planning a new OS that is as easy to use as windows and open source.

> However, count on me at least as a "break-my-machine-beta-tester".
> 
[* Nett, das jemand dabei ist, mit dem man auch Deutsch sprechen kannn *]

> Marcel

February 06, 2004
Stephan Wienczny wrote:

> Marcel Meyer wrote:
> 
>> Stephan Wienczny wrote:
>> 
>>>On the long run it might be a good idea to write an new open source compiler supporting D using D. I've been starting such a project,
>> 
>> 
>> Nonetheless, I would like the idea of a DCC - especially if all those conf and "make" thinks are somehow implemented. But do you think this is doable in a senseable time? I'm not yet very deep in compiler builds - so I'm quite naive. But everytime I think "what can be done" I just see sooo much work - just like making a really good GUI-toolkit (more like QT) for D - and then I just keep running away crying ;-).
> 
> The first thing I thought when starting the project was: "There is a lot of work", but I think I overestimated it. The hardest thing is the backend. Do you know some ASM-Guru that could help?
Hmm, if you don't reinvent the wheel but search for a nice existing "backend"-language, you could reuse their ports. I heard the Universität Karlsruhe created some great stuff in during the last year.

> Maybe you want to join in if you have some time.
Time? Time? Ah, that stuff I had before going to university... ;-)

> [* Nett, das jemand dabei ist, mit dem man auch Deutsch sprechen kannn *]
och, ich bin mir sicher sollte das mit dem DCC wirklich was werden, werden noch viele deutschsprachige Studis hinzustossen.

February 07, 2004
Marcel Meyer wrote:
> Hmm, if you don't reinvent the wheel but search for a nice existing
> "backend"-language, you could reuse their ports. I heard the Universität
> Karlsruhe created some great stuff in during the last year.

Do you still know how it was called? Have they published something?

Stephan


February 07, 2004
Stephan Wienczny wrote:

> Marcel Meyer wrote:
>> Hmm, if you don't reinvent the wheel but search for a nice existing "backend"-language, you could reuse their ports. I heard the Universität Karlsruhe created some great stuff in during the last year.
> 
> Do you still know how it was called? Have they published something?

Phew... I already searched for it. But I can't recall. Well, but that was just an example. There are others.

How deep is your experience in building compilers? Did you already write some? Despite of some lectures in "formale Sprachen" and a (very) few projects in MI-assembler I don't have any clue what you really need for a compiler. I will start learning for my "Diplomhauptprüfung" the next semester - we'll see what happens ;-).

But for now I really can't give you any tips - I guess you're far more qualilfied if you dare to start such a project :-D

Is the principle of GCC, source-frontend-intermediate-_language-backend-asm, unique to it? I've never seen any other compiler working like that.
« First   ‹ Prev
1 2