Search code examples
compiler-construction

Has a programming language ever been written in itself?


Okay, so I know that, typically, a language is written in another language (such as Python is written in C).

However, has there ever been a language which is written using itself? Obviously, they'd have to use a compiler / interpreter from a previous version of the language, which means, at least initially, it would've been written in something else.

I realize it would be incredibly annoying and pointless to use an existing language to develop a compiler for a new language, only to immediately abandon it and write a new compiler in your new language (which you would then compile using your original compiler), but I don't really see a reason why it couldn't be done (though, again, I do see why it wouldn't be done).

Despite this, has it ever happened?


Solution

  • Yes, it's called Bootstrapping.

    In computer science, bootstrapping is the process of writing a compiler (or assembler) in the target programming language which it is intended to compile. Applying this technique leads to a self-hosting compiler. Many compilers for many programming languages are bootstrapped, including compilers for BASIC, ALGOL, C, Pascal, PL/I, Factor, Haskell, Modula-2, Oberon, OCaml, Common Lisp, Scheme, Java, Python, Scala and more.