티스토리 뷰

흔석/프로그램 개발

컴파일러란?

JOHNPARK82 2005. 9. 17. 09:38
A compiler is a computer program that translates a series of instructions written in one computer language (called the source language) into a resulting output in another computer language (also called the object or target language).

Introduction and history
Most compilers translate source code written in a high level language to object code or machine language that may be directly executed by a computer or a virtual machine. However, translation from a low level language to a high level one is also possible; this is normally known as a decompiler if it is reconstructing a high level language program which (could have) generated the low level language program. Compilers also exist which translate from one high level language to another (cross compilers), or sometimes to an intermediate language that still needs further processing; these are sometimes known as cascaders.

Typical compilers output so-called objects that basically contain machine code augmented by information about the name and location of entry points and external calls (to functions not contained in the object). A set of object files, which need not have all come from a single compiler provided that the compilers used share a common output format, may then be linked together to create the final executable which can be run directly by a user.

Several experimental compilers were developed in the 1950s, but the FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler, in 1957. COBOL was an early language to be compiled on multiple architectures, in 1960. [1]

The idea of compilation quickly caught on, and most of the principles of compiler design were developed during the 1960s.

A compiler is itself a computer program written in some implementation language. Early compilers were written in assembly language. The first self-hosting compiler -- capable of compiling its own source code in a high-level language -- was created for Lisp by Hart and Levin at MIT in 1962. [2] The use of high-level languages for writing compilers gained added impetus in the early 1970s when Pascal and C compilers were written in their own languages. Building a self-hosting compiler is a bootstrapping problem -- the first such compiler for a language must be compiled either by a compiler written in a different language, or (as in Hart and Levin's Lisp compiler) compiled by running the compiler in an interpreter.

During the 1980s and 1990s a large number of free compilers and compiler development tools were developed for all kinds of languages, both as part of the GNU project and other open-source initiatives. Some of them are considered to be of high quality and their free source code makes a nice read for anyone interested in modern compiler concepts.
http://en.wikipedia.org/wiki/Compiler


컴파일러는 한 프로그램 언어로 쓰여진 명령문을 다른 언어로 바꾸는 컴퓨터 프로그램을 말한다. 이때 원본 언어를 소스 랭귀지, 아웃풋 언어를 목적, 타켓 언어라고 명명한다.

여기서 중요한 것은 한언어를 다른 언어로 바꾸는 모든 것을 컴파일러라고 부른다는 것! 변역기역시 컴파일러의 범주안에 포함될 수 있다.

흔히 컴파일러를 기계어로 바꾸어주는 혹은 어셈블리로만 바꾸어 주는 것으로 한정지어 생각하기 쉬운데 컴파일러는 이런 작은 범주의 것이 아니다.

그리고 기계어로 바꾸어 주는 작업을 어셈블링한다고 표현한다. 이는 언어를 언어로 바꾸어 주는 것이 아니라 어셈의 특징인 1:1 매핑되는 이진 구조로만 바꾸어주는 것이기 때문에 컴파일한다고 표현하지 않는다.