This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC Needs a backend cleanup and complete rewrite
Gabriel Dos Reis wrote:
>
> Phil Edwards <pedwards@disaster.jaj.com> writes:
>
> [...]
>
> | I would love to see this. Maybe not in C++, but along the same lines.
> | One of the many difficulties in changing the implementation language is that
> | FSF requires GCC to be buildable on just about any machine that ever worked,
> | even if it only has a K&R compiler from the previous century. (Okay, that
> | was a lame shot, sorry.) We cannot assume the existence of a bootstrapping
> | C++/whatever compiler the same way as we can assume a C compiler.
>
> That is irrelevent.
>
> One only needs to have the bootstrap-start written in portable
> C. The rest can be written in C++ -- there have been a widely known
> compiler which did that. Actually, that would make it possible to
> exercice the compiler itself -- that is one of the reasons why GNU C
> front-end is much more reliable.
>
> But rewriting the front-end in C++ doesn't automagically imply the
> front-end will be well-structured or well-documented. It can be
> worse.
You could make a C++ wrapper like has been done for other
libraries (gtk for example). Then you would have both the current
C backend, and a C++ backend for those who want to use that.
I think that if it is done right, a C++ back end might make
it easier for someone to write a new front end (and understand
the back end), because it would (if written right) group
functions into a logical relationship.