Self-hosting(Redirected from Self-hosting compiler)
This article needs additional citations for verification. (April 2010) (Learn how and when to remove this template message)
Self-hosting is 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, often using a cross compiler, 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 without using another host system is rare.
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.
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
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.
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 used 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++, C#, CoffeeScript, Dylan, F#, FASM, Forth, Gambas, Go, Haskell, HolyC, Java, Lisp, Modula-2, OCaml, Oberon, Pascal, Python, Rust, Scala, Smalltalk, TypeScript, Vala, and Visual Basic.
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.
In the context of website management and online publishing, the term "self hosting" is used to describe the practice of running and maintaining a website using a private web server. The concept of self hosting is mostly relevant in situations where a webmaster has a clear and immediate "hosted" alternative, however the term can be applied in other situations. A hosted solution is any service whereby an external provider is relied upon to provide a fully managed service, which might include adequate server space, on-demand support, and regular software updates.
There is often confusion as to what constitutes "self hosted" or "hosted". The key distinction lies in the amount of control a webmaster has over the web property. A good example of the self hosting vs. hosted dichotomy would be WordPress, a widely used, free and open-source content management system (CMS). A webmaster could choose to use either WordPress.com, which is a largely free service maintained by the company Automattic, or alternatively download the underlying WordPress software from WordPress.org. The latter option would enable the webmaster to install the WordPress software manually on his or her own private web server, whether that server is leased from a web hosting provider or set up in house. In summary, WordPress.com can serve as a hosted alternative, whereas WordPress.org could constitute as self hosting.
Some services like Shopify could also constitute as "hosted" services. Shopify is an example of a SaaS-based ecommerce platform, which offers customers a fully managed service, including proprietary website-building software, on-demand support, and server space/hosting. Since the Shopify software is proprietary and not open source, there is no "self hosting" alternative.
- Tim Hart and Mike Levin. "AI Memo 39-The new compiler" (PDF). Retrieved 2008-05-23.[permanent dead link]
- Dennis M. Ritchie. "The Development of the C Language". 1993.
- gcc 4.8, LLVM/clang
- Mono gmcs and Microsoft Roslyn
- "Self Hosting". Retrieved 2017-05-07.[dead link]
- "Best Web Hosting Services in 2018 - CriticsThoughts.com". 2018-02-06. Retrieved 2018-02-27.
- "Ecommerce Software – How do I install Shopify?". Shopify. Retrieved 2017-05-07.