A compiler is a Computer program which translates a language, the source language , in another, called the language targets , by preserving the significance of the source text. This general outline describes a great number of different programs; and what one understands by “significance of the source text” depends on the role of the compiler. When one speaks about compiler, one as in general supposes as the source language is, for the application considered, moreover high level that the target language, i.e. it presents a higher level of abstraction.
In practice, a compiler is generally used to translate a Source code writes in a Computer programming language in another language, usually a Assembly language or a Machine language. The program in machine language produces by a compiler is called Object code.
The first compiler was written by Grace Hopper.
A compiler functions by analyze-synthesis, i.e. instead of replacing each construction of the source language by an equivalent succession of constructions of the target language, it starts by analyzing the source text to build of it an intermediate representation which it translates in its turn into target language.
It is thus natural to separate - at least conceptually, but also in practical - the compiler in a part before (or frontal), sometimes called “stock”, which read the source text and produce the intermediate representation, and a back part (or finale), which traverses this representation to produce the target text. In an ideal compiler, the front part is independent of the target language, while the back part is independent of the source language. Certain compilers carry out moreover on the intermediate form of the substantial treatments, which one can gather in a central part, independent at the same time of the source language and target machine. One can thus write compilers for a whole range of languages and architectures by sharing the central part, to which one attaches a front part by language and a back part by architecture.
The stages of compilation include
These various stages explain why the compilers are always the subject of research, particularly in the field of the optimization of the produced code.
The majority (but not all) of the compilers translate a source file of a program written in a computer programming language into a file object (or achievable, or a file out of assembler, or even in another language).
An implementation (realization concretes) of a computer programming language can be interpreted or compiled. It is this realization which is a compiler or a Interpréteur, and a computer programming language (more or less theoretical and formalized specification its syntax and of its semantics) can have a compiled implementation, and another interpreted.
Certain compilers translate, in an incremental or interactive way, the source program (typed by the user) in computer code. For example, certain implementations of Common Lisp (as SBCL) translate an end of program into computer code (in memory).
The Just compilers In Time (just in time) translate an intermediate representation (often code byte) into computer code, in a progressive way.
The current compilers are generally written in the language that they must compile; for example a compiler C is written out of C, SmallTalk in SmallTalk, Lisp in Lisp, etc In the realization of a compiler, a decisive stage is crossed when the compiler for language X is sufficiently complete to be compiled itself: it then does not depend any more a another language (this was assembler) to be produced.
The bugs of the compilers are sometimes very complex to detect. If a compiler of language C comprises a bug, the programmers in Langage C will naturally tend to blame their own source code, not the compiler.
Worse, if this buggé compiler (V1 version) compiles a compiler (V2 version) not buggé, the achievable one compiled (by V1) of the V2 compiler will be buggé. However its source code is good. The bootstrap thus obliges the programmers of compilers to circumvent the bugs existing compilers.
Simple: To compile
| Random links: | Pneumatic machine (dwarf galaxy) | Takao Kobayashi | Freguesia | Senegalese party of progress | Microrégion de Cruzeiro C Sul |