Compiler

Compile is a redirect to this article. For other meanings of the term, see Compilation.

A compiler (also compiler; from English compile 'to compile' or Latin compilare 'to pile up') is a computer program that translates source codes of a certain programming language into a form that can be executed (more directly) by a computer. This results in a more or less directly executable program. To be distinguished from this are interpreters, for example for early versions of BASIC, which do not produce machine code.

A distinction is sometimes made between the terms translator and compiler. A translator translates a program from a formal source language into a semantic equivalent in a formal target language. Compilers are special translators that convert program code from problem-oriented programming languages, so-called high-level languages, into executable machine code of a certain architecture or an intermediate code (bytecode, p-code or .NET code). This separation between the terms translator and compiler is not made in all cases.

The process of translation is also called compilation or conversion (or with the corresponding verb). The opposite, that is, the retranslation of machine language into source code of a particular programming language, is called decompilation and corresponding programs decompiler.

Terminology

A translator is a program that accepts as input a program formulated in a source language and translates it into a semantically equivalent program in a target language. Thus, in particular, it is required that the generated program produces the same results as the given program. The source language assembler is often regarded as an exception - its translator (into machine code) is called "assembler" and is generally not called "compiler". The translator's task covers a wide range of subtasks, from syntax analysis to target code generation. An important task is also to detect and report errors in the source program.

The word "compiler" is derived from the English "to compile" and means "compiler" in the true sense of the word. In the 1950s, the term was not yet firmly anchored in the computer world. Originally, compilers referred to a utility program that assembled an entire program from individual subroutines or formula evaluations in order to perform special tasks. (Today, this task is performed by the linker, which can, however, also be integrated in the compiler). The individual subroutines were still written "by hand" in machine language. From 1954 on, the term "algebraic compiler" appeared for a program that independently took over the conversion of formulas into machine code. The "algebraic" fell away in the course of time.

At the end of the 1950s, the term compiler was still controversial in the English-speaking world. Thus, the Fortran development team held on to the term "translator" for years to describe the compiler. This term is even included in the name of the programming language Fortran itself: Fortran is composed of Formula and Translation, meaning roughly formula translation. It was not until 1964 that the term compiler prevailed over the term translator in connection with Fortran. According to Carsten Busch, there is a "particular irony of history" in the fact that the term compiler is translated into German as "translator". However, some German publications also use the English technical term compiler instead of translator.

In a narrower sense, however, some German-language publications use the technical term compiler only when the source language is a higher programming language than the target language. Typical use cases are the translation of a higher programming language into the machine language of a computer, as well as the translation into bytecode of a virtual machine. The target language of compilers (in this sense) can also be an assembly language. A translator for transferring assembly language source programs into machine language is called an assembler or assembler.

History

Already for the first designed higher programming language, the plan calculus by Konrad Zuse, he planned - according to today's terminology - a compiler. Zuse referred to a single program as a computational plan and as early as 1944 had the idea for a so-called plan production device, which was to automatically generate a punched punched tape with a corresponding machine plan for the Zuse Z4 computer from a mathematically formulated computational plan.

More concrete than Zuse's idea of a plan production device was a concept by Heinz Rutishauser for automatic computational plan production. In a lecture to the Society for Applied Mathematics and Mechanics (GAMM), as well as in 1951 in his post-doctoral thesis at the ETH Zurich, he described which additional programming commands (instructions) and hardware additions were necessary on the Z4 then in use at the ETHZ in order to also use the computer as a tool for automatic program production.

An early compiler was conceived by mathematician Grace Hopper in 1949. Until then, programmers had to write machine code directly. (The first assembler was written between 1948 and 1950 by Nathaniel Rochester for an IBM 701). To simplify this process, Grace Hopper developed a method for expressing programs and their subroutines in a manner more closely aligned with human than machine language. On May 3, 1952, Hopper introduced the first compiler, A-0, which retrieved algorithms from a catalog, rewrote code, assembled them in appropriate order, reserved memory space, and organized the allocation of memory addresses. By early 1955, Hopper had already presented a prototype of the B-0 compiler, which generated programs according to English, French, or German instructions. Hopper called her presentation on the first compiler "The Education of a Computer".

The history of compiler construction was shaped by the respective current programming languages (cf. Timetable of Programming Languages) and hardware architectures. Other early milestones include the first Fortran compiler in 1957 and the first COBOL compiler in 1960. However, many architectural features of today's compilers were not developed until the 1960s.

In the past, programs that merge subroutines were sometimes called compilers. This misses the core task of a compiler today, because nowadays subroutines can be inserted by other means: Either in the source code itself, for example by a preprocessor (see also precompiler) or, in the case of translated components, by an independent linker.

Grace Hopper (1984)Zoom
Grace Hopper (1984)


AlegsaOnline.com - 2020 / 2023 - License CC3