Re: Bootstraping compilers ?

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Tue, 22 Apr 2008 20:07:33 +0200

          From comp.compilers

Related articles
[7 earlier articles]
Re: Bootstraping compilers ? cdb@nullstone.com (Christopher Glaeser) (2008-04-19)
Re: Bootstraping compilers ? torbenm@app-4.diku.dk (2008-04-21)
Re: Bootstraping compilers ? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-04-21)
Re: Bootstraping compilers ? pocm@soton.ac.uk (2008-04-22)
Re: Bootstraping compilers ? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-04-21)
Re: Bootstraping compilers ? spencer@panix.com (David Spencer) (2008-04-22)
Re: Bootstraping compilers ? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2008-04-22)
Re: Bootstraping compilers ? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2008-04-23)
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Tue, 22 Apr 2008 20:07:33 +0200
Organization: Compilers Central
References: 08-04-059 08-04-066 08-04-080
Keywords: practice, C
Posted-Date: 22 Apr 2008 19:41:47 EDT

Paulo Jorge de O. C. de Matos wrote:


>>However once you have written a C99 compiler (using C95) you can then
>>write a C99 compiler and compile it with itself (after the first
>>compilation using the C99 compiler written in C95)
>
>
> Thanks you all for your replies. Chris, this is making me
> confused. Does your quote mean that I would have to write two
> compilers? One compiler in C95 and one in C99? So the first would
> accept C99, the second in C99 is then fed into the first?


Consider two aspects: the language to compile, and the compiler itself.


With regards to the language you may want to retain backwards
compatibility, or multiple "idioms" of the language, which may be
selectable by command line switches. This part can grow or shrink,
whatever functionality you want to put into, or remove from, your
concrete compiler. The lexer/parser may be implemented for C99, with
conditional branches in the semantic code to reject or allow for the
recognition of the C95/C99 or any sooner (or later) language specs. A
parser frequently will accept more (syntactic) constructs, whereas the
exact language specification (including semantics) will be implemented
by semantic code only.


The compiler itself may not profit from new language features, so that
this code can stay in the old (C95) version - provided backwards
compatibility of the language specs.


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.