- Self-hosting
The term: Self-hosting was coined to refer to the use of a
computer program as part of thetoolchain oroperating system that produces new versions of that same program—for example, acompiler that can compile its ownsource code . Self-hosting software is commonplace on personal computers and larger systems. Other programs that are typically self-hosting include kernels, assemblers, and shells.The same concept also applies to energy systems. For example, the first steam engines were manufactured using hydro mechanical power (water mills), but once steam engines were used to generate the mechanical power used to manufacture other steam engines, steam power became self hosting.
If a system is so new that no software has been written for it, then software is developed on another self-hosting system and placed on a storage device that the new system can read. Development continues this way until the new system can reliably host its own development. Development of the
Linux operating system, for example, was initially hosted on aMinix system. Writing new software development tools "from the metal" (that is, without using another host system) is rare and in many cases impossible.Several
programming language s are self-hosting, in the sense that a compiler for the language, written in the same language, is available. The first compiler for a new programming language can be written in another language (in rare cases, machine language) or produced using bootstrapping. Self-hosting languages include Perl, Lisp, Forth, Pascal, Delphi, C,Modula-2 , Oberon, Smalltalk,OCaml ,FASM , andFreeBASIC .History
The first self-hosting compiler (excluding assemblers) was written for Lisp by Hart and Levin at MIT in
1962 . Because Lisp interpreters existed previously, but no Lisp compilers, they used an original method to compile their compiler. The compiler, like any other Lisp program, could be run in a Lisp interpreter. So they simply ran the compiler in the interpreter, giving it "its own source code" to compile.:"The compiler as it exists on the standard compiler tape is a machine language program that was obtained by having the
S-expression definition of the compiler work on itself through the interpreter." (AI Memo 39)cite web | title=AI Memo 39-The new compiler| author=Tim Hart and Mike Levin | url=ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-039.pdf | accessdate=2008-05-23] This technique is only possible when an interpreter already exists for the very same language that is to be compiled. It borrows directly from the notion of running a program on itself as input, which is also used in various proofs intheoretical computer science , such as the proof that thehalting problem is undecidable.References
ee also
*
Bootstrapping (compilers)
*Cross-compiler
*Dogfooding
*Futamura projection
*Self-interpreter
*Self reference
Wikimedia Foundation. 2010.