Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1440
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: self-hosting, was Writing A Plain English Compiler |
| Date | 2014-11-12 11:15 +0000 |
| Organization | virginmedia.com |
| Message-ID | <14-11-032@comp.compilers> (permalink) |
| References | (4 earlier) <14-11-016@comp.compilers> <14-11-020@comp.compilers> <14-11-028@comp.compilers> <14-11-029@comp.compilers> <14-11-031@comp.compilers> |
"Anton Ertl" <anton@mips.complang.tuwien.ac.at> wrote in message > "BartC" <bc@freeuk.com> writes: >>It does, however, run into problems, such as frequently ending up with >>non-working compilers and/or support programs, and with most of the >>bridges >>burnt! Then recovering can be tricky. > > To deal with that, you have a "stable" and executable (or buildable) > version somewhere, and make sure that your compiler builds with that > version. So if the current version no longer builds with itself, you > build it with the stable version; for that you also need a simple way > to switch from building with the current version (default) to building > with the stable version. There are still problems, especially with on-going development of a language and its compiler. For example, you make an enhancement in the language. The compiler source is modified, and the change is tested and it works. Then you decide to make use of the new feature in the compiler code. The problem comes when something else doesn't work and you need to revert back, but those old binaries will not support the new feature that now litters the compiler sources! In the case of bytecode languages, there is a more specific problem: the bytecode format could be modified in such a way that new binary bytecode files will be incompatible with both old bytecode files, and with the interpreter used. (This might be as simple as adding a new bytecode instruction.) Now, with a self-hosting system where all the support programs (the compiler, any loader (a program that does a similar job to a linker but for bytecode), libraries, and even IDEs and editors) will all be using version X, and the interpreter runs only version X, everything needs to be switched over to version Y. But everything can't be done simultaneously, so it gets messy (with X-X, X-Y, and Y-Y versions being involved). Without self-hosting and using external tools maintained by someone else, most of these headaches would disappear. (I do it because I like the satisfaction of being independent.) "Anton Ertl" <anton@mips.complang.tuwien.ac.at> wrote in message > Another reason to self-host a compiler is the signal it sends: If you > claim that your language is general-purpose, and you write the > compiler for it in a different language, you are obviously not very > convinced of the capabilities of your language, so why should anybody > else use it? Sometimes you have to use a different language to get started. Or you may be modifying a compiler which is in another language (perhaps one of yours) to compile a new language, and it would be silly to rewrite it in the new language just for the purpose of being able to say it's self-hosted. Another problem with self-hosting is distributing the program so that someone else can use it. But is that done as a binary executable, or as source-code? With source-code in a new language, no-one will yet have a working binary compiler to build it! While binary distributions have all the usual problems (of supporting multiple platforms and getting people to trust it). (If I was distributing a new language compiler, it would likely be in the form of a single C source file. However, because my compilers aren't written in C, and are interpreted, that single file would actually be the interpreter, plus the compiler bytecode represented as data within the C source.) -- Bartc [That's fine -- tools like bison are written in themselves, but they distribute enough C code to bootstrap it. -John]
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Writing A Plain English Compiler "Gerry Rzeppa" <gerry.rzeppa@pobox.com> - 2014-11-04 15:50 -0600
Re: Writing A Plain English Compiler Joshua Cranmer 🐧 <Pidgeot18@verizon.net> - 2014-11-05 00:54 -0600
Re: Writing A Plain English Compiler "Gerry Rzeppa" <gerry.rzeppa@pobox.com> - 2014-11-06 18:52 -0600
Re: Writing A Plain English Compiler Joshua Cranmer 🐧 <Pidgeot18@verizon.net> - 2014-11-07 22:54 -0600
Re: Writing A Plain English Compiler "Gerry Rzeppa" <gerry.rzeppa@pobox.com> - 2014-11-08 02:41 -0600
Re: Writing A Plain English Compiler "Gerry Rzeppa" <gerry.rzeppa@pobox.com> - 2014-11-08 03:46 -0600
Re: Writing A Plain English Compiler "BartC" <bc@freeuk.com> - 2014-11-09 01:16 +0000
Re: Writing A Plain English Compiler "Gerry Rzeppa" <gerry.rzeppa@pobox.com> - 2014-11-10 14:37 -0600
Re: self-hosting, was Writing A Plain English Compiler Richard Hable <portempa@aon.at> - 2014-11-11 19:50 +0100
Re: self-hosting, was Writing A Plain English Compiler "BartC" <bc@freeuk.com> - 2014-11-11 23:33 +0000
Re: self-hosting, was Writing A Plain English Compiler anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-11-12 08:46 +0000
Re: self-hosting, was Writing A Plain English Compiler "BartC" <bc@freeuk.com> - 2014-11-12 11:15 +0000
Re: self-hosting, was Writing A Plain English Compiler anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-11-12 08:40 +0000
Re: Writing A Plain English Compiler "BartC" <bcas@freeuk.com> - 2014-11-07 11:36 +0000
Re: Writing A Plain English Compiler George Neuner <gneuner2@comcast.net> - 2014-11-07 16:23 -0500
Re: Writing A Plain English Compiler Richard Hable <portempa@aon.at> - 2014-11-08 17:22 +0100
Re: Writing A Plain English Compiler Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-11-08 10:48 -0600
Re: language design models, was Writing A Plain English Compiler George Neuner <gneuner2@comcast.net> - 2014-11-09 14:30 -0500
Re: language design models, was Writing A Plain English Compiler "Gerry Rzeppa" <gerry.rzeppa@pobox.com> - 2014-11-10 03:29 -0600
Re: Writing A Plain English Compiler Tomasz Kowaltowski <tk@ic.unicamp.br> - 2014-11-10 09:13 -0200
Re: Writing A Plain English Compiler "Gerry Rzeppa" <gerry.rzeppa@pobox.com> - 2014-11-10 17:19 -0600
Re: matching tasks to languages, was Writing A Plain English Compiler Gene Wirchenko <genew@telus.net> - 2014-11-10 15:37 -0800
Re: Writing A Plain English Compiler Martin Ward <martin@gkc.org.uk> - 2014-11-10 22:56 +0000
Re: Writing A Plain English Compiler "BartC" <bcas@freeuk.com> - 2014-11-07 11:39 +0000
Re: Writing A Plain English Compiler "BartC" <bc@freeuk.com> - 2014-11-08 00:35 +0000
Fundamentals for a Compiler and Language (was: Writing A Plain English Compiler) federation2005@netzero.com - 2014-12-29 13:30 -0800
csiph-web