What are the types of Compilers?

Compiler DesignProgramming LanguagesComputer Programming

A compiler is a computer program that changes source code written in a high-level language into low-level machine language. It translates the code written in one programming language to some other language without modifying the definition of the code. The compiler also produces the end code efficient which is optimized for execution time and memory space.

There are various types of compilers which are as follows −

Traditional Compilers(C, C++, and Pascal) − These compilers transform a source program in an HLL into its similar in native machine program or object program.

Interpreters (LISP, SNOBOL, and Java1.0) − These Compilers first convert Source code into intermediate code, and then interprets (emulates) it to its equivalent machine code.

Cross-Compilers − These are the compilers that run on one machine and make code for another machine. A cross compiler is a compiler adequate for making executable code for a platform other than the one on which the compiler is running. Cross compiler tools are used to create executables for installed systems or several platforms.

Incremental Compilers − Incremental Compiler is a compiler, which executes the recompilation of only a changed source instead of compiling the complete source code.

Converters (e.g. COBOL to C++) − These programs will be compiling from one high-level language to another.

Just-In-Time (JIT) Compilers (Java, Micosoft.NET) − These are the runtime compilers from intermediate language (byte code, MSIL) to executable code or native machine code. These implement type-based verification which creates the executable code more authentic.

Single-Pass Compiler − In a single-pass compiler, when a line source is processed it is scanned and the tokens are extracted. Thus the syntax of the line is inspected and the tree structure and some tables including data about each token are constructed. Finally, after the semantical element is tested for correctness, the code is created. The same process is repeated for each line of code until the whole program is compiled. Usually, the entire compiler is built around the parser, which will call procedures that will perform different functions.

Multi-Pass Compiler − The compiler scans the input source once and makes the first modified structure, therefore scans the first-produced form and makes a second modified structure, etc., until the object form is produced. Such a compiler is known as a multi-pass compiler.

Ahead-of-Time (AOT) Compilers (e.g., .NET ngen) − These are the pre-compilers to the native code for Java and .NET.

Binary Compilation − These compilers will be compiling the object code of one platform into the object code of another platform.

raja
Updated on 22-Oct-2021 11:42:45

Advertisements