14

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?

Wooble
  • 87,717
  • 12
  • 108
  • 131
  • 3
    Programming languages are specifications. Implementations (e.g. compilers, VMs) are, well, implementations of those specifications. And yes, there are implementations that run/compile the programming language they were written in. Normally there are a series of "bootstraps" to get up to that point, however. – user2246674 Sep 18 '13 at 01:53
  • 1
    Kind of duplicate: [bootstrapping-a-language](http://stackoverflow.com/questions/13537/bootstrapping-a-language) – nawfal Jul 21 '14 at 11:20

1 Answers1

17

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.

Ryan T. Grimm
  • 1,307
  • 1
  • 9
  • 17
  • 1
    Ah, of course. In my head, I was thinking of developing a complete general-purpose compiler first, then developing a compiler in the language later. I didn't consider simply developing a small, minimalistic compiler first. Thanks! –  Sep 18 '13 at 01:59