Skip to main content

There are three languages involved in a compiler: the language being compiled (source language), the language being compiled into (target language), and the language that the compiler is written in (implementation language). In general, the implementation language is either a general purpose language like C or C++, or the source language. The target language can be some language suitable close to the source language that already exists, or assembly. Sometimes there is a custom intermediate language, so that there can be a common backend for a variety of languages. This is the way that gcc works. There is a front end for C, C++, Fortran, Ada, and probably others. Each one is compiled into the same intermediate language, which is then compiled into architecture specific assembly language.

If the compiler is written in the same language as the one it's compiling, the compiler is called self-hosting. If a language is new, then no compiler exists for it already, which means that its first compiler cannot be self-hosting (otherwise, how would that first compiler be compiled?). As a result, the first iteration of any compiler for a new language is always written in a different language. That having been said, a self-hosting is more convenient; the author(s) only need to be proficient in one language.

There are three languages involved in a compiler: the language being compiled (source language), the language being compiled into (target language), and the language that the compiler is written in (implementation language). In general, the implementation language is either a general purpose language like C or C++, or the source language. The target language can be some language suitable close to the source language that already exists, or assembly. Sometimes there is a custom intermediate language, so that there can be a common backend for a variety of languages. This is the way that gcc works. There is a front end for C, C++, Fortran, Ada, and probably others. Each one is compiled into the same intermediate language, which is then compiled into architecture specific assembly language.

There are three languages involved in a compiler: the language being compiled (source language), the language being compiled into (target language), and the language that the compiler is written in (implementation language). In general, the implementation language is either a general purpose language like C or C++, or the source language. The target language can be some language suitable close to the source language that already exists, or assembly. Sometimes there is a custom intermediate language, so that there can be a common backend for a variety of languages. This is the way that gcc works. There is a front end for C, C++, Fortran, Ada, and probably others. Each one is compiled into the same intermediate language, which is then compiled into architecture specific assembly language.

If the compiler is written in the same language as the one it's compiling, the compiler is called self-hosting. If a language is new, then no compiler exists for it already, which means that its first compiler cannot be self-hosting (otherwise, how would that first compiler be compiled?). As a result, the first iteration of any compiler for a new language is always written in a different language. That having been said, a self-hosting is more convenient; the author(s) only need to be proficient in one language.

added 9 characters in body
Source Link
KeithB
  • 10.2k
  • 2
  • 24
  • 17

There are three languages involved in a compiler: the language being compiled (source language), the language being compiled into (target language), and the language that the compiler is written in (implementation language). In general, the implementation language is either a general purpose language like C or C++, or the source language. The target language can be some language suitable close to the source language that already exists, or assembly. Sometimes there is a custom intermediate language, so that there can be a common backend for a variety of languages. This is the way that gcc works. There is a front end for C, C++, Fortran, Ada, and probably others. Each one is compiled into the same intermediate language, which is then compiled into architecture specific assembly language.

There are three languages involved in a compiler: the language being compiled (source language), the language being compiled into (target language), and the language that the compiler is written in (implementation language). In general, the implementation is either a general purpose language like C or C++, or the source language. The target language can be some language suitable close to the source language that already exists, or assembly. Sometimes there is a custom intermediate language, so that there can be a common backend for a variety of languages. This is the way that gcc works. There is a front end for C, C++, Fortran, Ada, and probably others. Each one is compiled into the same intermediate language, which is then compiled into architecture specific assembly language.

There are three languages involved in a compiler: the language being compiled (source language), the language being compiled into (target language), and the language that the compiler is written in (implementation language). In general, the implementation language is either a general purpose language like C or C++, or the source language. The target language can be some language suitable close to the source language that already exists, or assembly. Sometimes there is a custom intermediate language, so that there can be a common backend for a variety of languages. This is the way that gcc works. There is a front end for C, C++, Fortran, Ada, and probably others. Each one is compiled into the same intermediate language, which is then compiled into architecture specific assembly language.

Source Link
KeithB
  • 10.2k
  • 2
  • 24
  • 17

There are three languages involved in a compiler: the language being compiled (source language), the language being compiled into (target language), and the language that the compiler is written in (implementation language). In general, the implementation is either a general purpose language like C or C++, or the source language. The target language can be some language suitable close to the source language that already exists, or assembly. Sometimes there is a custom intermediate language, so that there can be a common backend for a variety of languages. This is the way that gcc works. There is a front end for C, C++, Fortran, Ada, and probably others. Each one is compiled into the same intermediate language, which is then compiled into architecture specific assembly language.