tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] modern c++ compiler written in C (food for thought)


From: Basile Starynkevitch
Subject: Re: [Tinycc-devel] modern c++ compiler written in C (food for thought)
Date: Tue, 27 Oct 2015 03:24:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.3.0


Just an idea related to the subject.

A C++ compiler needs to be optimizing. The C++ language specification sort-of requires an optimizing compiler (so a tinyc++ won't have any sense, IMHO).

A good optimizing compiler for C or C++ could be written in something different than C or C++.

In particular, it could be written in some higher level language. For instance, Lisp or Ocaml are language much more easier to code in a C or C++ compiler than C or C++ is.

A possible approach might be to code such a compiler in some own domain specific language translated to C or C++. So the bulk of the compiler would be coded in some language X (to be chosen, or designed ad-hoc), and it will contain a translator from X to C or C++ (and the repository would also contain the translated form of that translator).

For what it is worth, MELT (which is mostly my work) is demonstrating that this is possible, since it is a domain specific language to extend and customize GCC. See http://gcc-melt.org/

I'm not motivated enough to start coding alone a compiler for C or C++, but I am just suggesting a route
for those brave enough (or perhaps crazy enough) to try.

Regards.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***




reply via email to

[Prev in Thread] Current Thread [Next in Thread]