This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC - Alternatives to gengtype


On Sat, Nov 17, 2012 at 07:03:33AM -0500, Richard Kenner wrote:
> > First, C or C++ is not the best language to write a compiler in, 
> 
> It is my strong opinion that the best language to write a compiler in is
> the language that it is compiling (or the primary language in the case
> of a multi-language compiler like GCC).

I tend to half agree with that, but GCC is not exactly coded in C (or in C++). It has a lot of C code generators (gengtype, genautomata, and all the other gen*) and the combined amount of generated (C or C++) code in GCC is not insignificant.

If we continue on that route, we could have more (not less) specialized (C++ or C) code generators in GCC, and write more source for them, and still have GCC compiling itself since it is compiling the generated C++ code.

There is nothing really new in that idea, but it is surprising how many people believe that GCC is coded only in C or C++; it is not. It has a lot of specialized [C or C++] code generators.

(my own MELT work http://gcc-melt.org/ is pushing the idea of a domain specific language -translated to C or C++ - to code GCC extensions in).


In other words, I believe that having more generated C (or C++) code is not a bad thing. It gives us both the expressivity of (specialized, domain specific) languages fitted for their task, and the overall auto-compilation of GCC (which is important for testing, and for social, purposes).

Notice however that the Go front-end is not coded in Go, and the Fortran front-end is not coded in Fortran. AFAIK, some of Ada front-end is coded in Ada.


C is good as a system programming language; it might not be so good for hand-written compilers (and C code generators related to compilation exist since many many years, e.g. yacc, lex, burg, ..... and all our gen* things)

Cheers.


-- 
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 mines, sont seulement les miennes} ***


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]