This is the mail archive of the 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: A FrontEnd in C++? (Fergus Henderson)  wrote on 23.08.02 in <>:

> If you are working under those constraints, then rather than writing a
> whole compiler in the untrusted bootstrap language (e.g. C), it would
> be better to just write a simple bytecode interpreter in the untrusted
> bootstrap language.  A bytecode interpreter is going to be simpler than a
> compiler, so it is less likely to trigger bugs in the bootstrap compiler.
> Then, you write your compiler with two back-ends, one that compiles
> to this bytecode, and another that compiles to whatever it was that
> you really wanted to compile to (e.g. native code).  The compiler
> can be written in its own language, and bootstrapped using a trusted
> implementation of that language (or by some other means, e.g. see Robert
> Dewar's suggestions).
> Then you ship the sources plus the compiled bytecode for the compiler.
> When installing on untrusted systems, you first compile the bytecode
> interpreter, and then use that to run the compiled bytecode for the
> compiler, which you then use to compile your compiler to your chosen
> target language (e.g. native code).

I seem to remember suggesting something along those lines in one of the  
bootstrap-Ada debates, except I suggested using one of the existing  
emulators iff one was suitably portable.

It would also enable using full C99 in the C part of gcc, as the  
requirement to compile with the host compiler vanishes.

Note also that you do not necessarily need to regenerate the bytecode  
version of the compiler every time, only when you find that it doesn't do  
something (or does it wrong) that you need to have to bootstrap gcc.

MfG Kai

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