For different programming languages, is there different compiler or the compiler will be common to all the programming languages? In which language compiler will be written.
-
1This question appears to be off-topic because it is daft. – Oct 22 '13 at 04:06
-
See http://en.wikipedia.org/wiki/Bootstrapping_%28compilers%29 – megawac Oct 22 '13 at 04:06
4 Answers
You may be confusing a compiler (e.g. GCC) with an IDE (e.g. Microsoft Visual Studio.) The compiler is language-specific; the IDE can support multiple languages, each of which has a specific compiler.
Here's the thing:
Machines are dumb, they understand the language of binary digits ie. 1's and 0's
earlier there existed no translators so programmers were forced to give instructions in the language of the machine, which was difficult as it involved rewiring switches.
Then, in 1951, Grace Hopper developed the first compiler, which allowed the computer to be programmed using words and symbols rather than binary ones and zeroes. by "programming" we mean giving instructions. This made writing programs easier and the written instruction were refereed to as "Source Codes"
the primary job of any compiler is to perform the act of "compilation" ie. take this source code from the user (once written completely) and turn it into the "machine language" according to certain rules. Thus acting as translators.
now since different programming languages have different set of rules there exists different compilers specific to each such programming language These "rules" are basically syntactical and lexical rules, ie. what words and symbols can be used and how they can be combined to make some piece of code.
A compiler is heavily dependent on Automata theory to perform it's job of compilation.
As the techniques of programming developed other ways of converting source code to machine language came into existence, this gave rise to interpreted languages which involves compillation of each sentence or subroutein directly into machine language instructions. such compilation is performed by an interpreter.example: JavaScript
Today compilers and interpreters are used together to get best performance and increase usability on machines. example: Java which is a compiled as well as interpreted language.
**I believe the term "Compiler" is very generic.

- 3,499
- 1
- 27
- 44
-
You should replace dumb with something like unintelligent. Some computers actually _can_ speak :-) – paxdiablo Apr 22 '15 at 02:54
-
A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or "code" that a computer's processor uses. Typically, a programmer writes language statements in a language such as Pascal or C one line at a time using an editor . The file that is created contains what are called the source statements . The programmer then runs the appropriate language compiler, specifying the name of the file that contains the source statements.
So clearly, every language has its own specific language supported compiler to convert source code into machine code.
refer to this link for more information related to language in which compiler is written : How was the first compiler written?
I agree with above answer that java or other high level programming language's compiler must be written in C etc because it is a language closely related to machine.

- 1
- 1

- 2,295
- 4
- 23
- 46
-
Instead of saying "above" it would be better to refer to another answer by the user's name. For example `drj`. This is because the answers are not sorted chronologically and the accepted answer is generally sorted at the top. Currently there are zero answers above this answer so something doesn't make sense. – slebetman Jun 18 '14 at 16:16
-
No, compilers of high-level programming languages don't have to be written in C or any other *"language closely related to machine"*. A compiler for any language can be written in any language. For example C# compiler (Roslyn) is written in C# and you could build a compiler for any language in C#. – Ghost4Man Jul 19 '17 at 12:54
Different languages have different compilers.Compiler is written in some other language not every time, for java the compiler is written in C.

- 27
- 7