World Library  
Flag as Inappropriate
Email this Article


Article Id: WHEBN0000192092
Reproduction Date:

Title: Self-hosting  
Author: World Heritage Encyclopedia
Language: English
Subject: QB64, PyPy, Vala (programming language), CoffeeScript, History of compiler construction
Collection: Computer Programming, Self-Hosting Software
Publisher: World Heritage Encyclopedia


The term self-hosting was coined to refer to the use of a computer program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code. Self-hosting software is commonplace on personal computers and larger systems. Other programs that are typically self-hosting include kernels, assemblers, command-line interpreters and revision control software.

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. Writing new software development tools "from the metal" (that is, without using another host system) is rare and in many cases impractical.


  • History 1
  • Examples 2
  • See also 3
  • References 4


The first self-hosting compiler (excluding assemblers) was written for Lisp by Hart and Levin at MIT in 1962. They wrote a Lisp compiler in Lisp, testing it inside an existing Lisp interpreter. Once they had improved the compiler to the point where it could compile its own source code, it was self-hosting.[1]

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[1]

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 in theoretical computer science, such as the proof that the halting problem is undecidable.


Ken Thompson started development on Unix in 1968 by writing and compiling programs on the GE-635 and carrying them over to the PDP-7 for testing. After the initial Unix kernel, a command interpreter, an editor, an assembler, and a few utilities were completed, the Unix operating system was self-hosting - programs could be written and tested on the PDP-7 itself.[2]

Development of the Linux kernel was initially hosted on a Minix system. When sufficient packages, like GCC, GNU bash and other utilities are ported over, developers can work on new versions of Linux kernel based on older versions of itself (like building kernel 3.21 on a machine running kernel 3.18). This procedure can also be felt when building a new linux distribution from scratch.

Many programming languages have self-hosted implementations: compilers that are both in and for the same language. Such languages include Ada, BASIC, C, C++,[3] C#,[4] CoffeeScript, Dylan, F#, FASM, Forth, Gambas, Go, Haskell, Java, Lisp, Modula-2, OCaml, Oberon, Pascal, Python, Rust, Scala, tarun, Smalltalk, Vala, and Visual Basic.[4]

In some of these cases, the initial implementation was not self-hosted, but rather, written in another language (or even in machine language); in other cases, the initial implementation was developed using bootstrapping.

See also


  1. ^ a b Tim Hart and Mike Levin. "AI Memo 39-The new compiler" (PDF). Retrieved 2008-05-23. 
  2. ^ Dennis M. Ritchie. "The Development of the C Language". 1993.
  3. ^ gcc 4.8, LLVM/clang
  4. ^ a b Mono gmcs and Microsoft Roslyn
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.