Bootstrapping (compilers)

Bootstrapping is a computer science method to create a programming language, that is compiled with itself. In most cases, a compiler is written in a language, w…

Bootstrapping is a computer science method to create a programming language, that is compiled with itself. In most cases, a compiler is written in a language, where the compiler is rewritten for the language that is being compiled.[1]

Most popular programming languages all follow a pattern of bootstrapped compilers. Some notable ones include C, C#, D, Java, Pascal, Python, Rust, V (Vlang), and more.

Process

Bootstrapping usually has just a few stages: [2]

  • Build & prepare tools, and software to create a bootstrap compiler.[3]
  • Stage 1: Create a compiler for your programming language using another language, or whatever tools you have. This will be used to compile your final compilers.
  • Stage 2: Use your created compiler to recreate your original compiler. This should be identical to a stage 1 compiler.
  • Stage 3: Any newly added features would be added at stage 2, where the language is now only written in itself, and is compiled using a compiler, compiled in the same language.

Early Bootstrapping

In 1962, Tim Hart, and Mike Levin wrote a compiler for LISP, inside of LISP.[4] They improved the compiler until it was capable of compiling itself.

References

  1. Reynolds, John H. (December 2003). "Bootstrapping a self-compiling compiler from machine X to machine Y". CCSC: Eastern Conference. Journal of Computing Sciences in Colleges. 19 (2): 175–181. The idea of a compiler written in the language it compiles stirs up the old 'chicken-or-the-egg' conundrum: Where does the first one come from?
  2. "Advanced Build Configurations — LLVM 10 documentation". llvm.org.
  3. "Installing GCC: Building". GNU Project - Free Software Foundation (FSF).
  4. Tim Hart and Mike Levin. "AI Memo 39-The new compiler" (PDF). Archived from the original (PDF) on 2020-12-13. Retrieved 2008-05-23.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.