I was having this discussion with my friend and realized this might be the best place to ask this question ?
How is a new language born ? This new language NEW must be written in some old language OLD (eg C++ was written in C in initial stages), or how is this created ?? And, how does this language NEW can work itself if there is no compiler for it ? So, there must be some compiler for it ? Who writes compiler for it ?
So, how does all this work together, new language and its compiler, relation of new language with its old base language ?
You write the compiler in an implementation language until such time that the compiler can begin to compile enough of the new language to be used to implement the rest of the new language.
That's how it works.
Edit: Just to clarify, the commentors on this answer are also correct. The compiler doesn't HAVE to be written in the new language unless you want to. As said, some don't go that route and stay with the original implementation language.
Bootstrapping is a term used in computer science to describe the techniques involved in writing a compiler (or assembler) in the target programming language which it is intended to compile. This technique is also called self-hosting.
You may want to read up on programming language design and compiler design:
http://dragonbook.stanford.edu/
Bootstrapping (compilers)
http://en.wikipedia.org/wiki/Programming_language
http://www.paulgraham.com/langdes.html
Or, take a course or three at your local university.
The heart of any language is the linker and compiler, the compiler which converts source code into intermediary, very close to machine code, code. From this point, linkers are used to attach it to other binaries such as libraries, etc. After the binaries are linked to all logical pieces, they become an executable file in machine code (or translatable intermediary code as it is with .NET/Java).
The most translating from "human" english happens in the compiler, and there are great articles on how this is done... but to most of this it is in the realm of the supernatural, as the organizational skills required to write a working compiler are immense.
You can see the surface level sorts of translations and get a closer look at how compilers work by looking at language definitions (Bjarne Stroustrup's "The C++ Programming Language", Microsoft Press's "The C# Programming Language"), where both the appendixes and peppered throughout are lexical pieces, or rules which the compiler will use to translate your words into machine code in a very logical way.
I highly recommend reading the language definition of your favorite programming language if you wish to understand more, also the wikipedia article on compilers will give you a broader understanding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With