- optimizing compiler
- intermediate representation (ir)
- runtime system
- virtual machine
types of code|
- source code
- object code
- machine code
- just-in-time (jit)
- ahead-of-time (aot)
- android runtime (art)
- common language runtime (clr) & mono
- java virtual machine (jvm)
- zend engine
notable compilers & toolchains|
- gnu compiler collection (gcc)
a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language). the name compiler is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language, object code, or machine code) to create an executable program.:p1
however, there are many different types of compilers. if the compiled program can run on a computer whose cpu or operating system is different from the one on which the compiler runs, the compiler is a cross-compiler. a bootstrap compiler is written in the language that it intends to compile. a program that translates from a low-level language to a higher level one is a decompiler. a program that translates between high-level languages is usually called a source-to-source compiler or transcompiler. a language rewriter is usually a program that translates the form of expressions without a change of language. the term compiler-compiler refers to tools used to create parsers that perform syntax analysis.
a compiler is likely to perform many or all of the following operations: preprocessing, lexical analysis, parsing, semantic analysis (syntax-directed translation), conversion of input programs to an intermediate representation, code optimization and code generation. compilers implement these operations in phases that promote efficient design and correct transformations of source input to target output. program faults caused by incorrect compiler behavior can be very difficult to track down and work around; therefore, compiler implementers invest significant effort to ensure compiler correctness.
compilers are not the only language processor used to transform source programs. an interpreter is computer software that transforms and then executes the indicated operations.:p2 the translation process influences the design of computer languages which leads to a preference of compilation or interpretation. in practice, an interpreter can be implemented for compiled languages and compilers can be implemented for interpreted languages.