Compiler And Types Of Compiler

Hi Guys,

This article demonstrate the description of Compiler and their types in context of .NET framework.


A compiler is a program that transforms the source code written in any high level language into another low level language(e.g., assembly language or machine code) or native language also called Object Code which is understandable by compiler. The object code is machine Code that processor of the machine understand and execute one instruction at a time. A compiler is language specific. It means a compiler which is designed to transform the C#.NET code would be diferent than the  compiler for VB.NET or C++ compiler.

Types of Compiler: A compiler is of two types:

a) Single Pass Compiler

b) Multi Pass Compiler

Phases of Compiler

A compiler generally works in phases or “Pass”. There are following 6 phases on which a compiler works:

a)Lexical Analysis



d)Semantic analysis (Syntax-directed translation)

e)Code Generation

f)Code Optimization.


An interpreter translates high-level instructions into an intermediate form, which it then executes. In contrast, a compiler translates high-level instructions directly into machine language. Compiled programs generally run faster than interpreted programs. The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time-consuming if the program is long. The interpreter, on the other hand, can immediately execute high-level programs. For this reason, interpreters are sometimes used during the development of a program, when a programmer wants to add small sections at a time and test them quickly. In addition, interpreters are often used in education because they allow students to program interactively.  An Interpreter interpretes the source code line by line or One Instruction at a time.

Compiler In .NET Framework:

Initially source code written in C#,VB,C++ or any other language gets compiled by language specific compiler into MSIL(Intermediate Language) which is Microsoft Language Indpendent. Once the source code get converted into MSIL or IL it can be accessed by any high level language which supports microsoft plateform. You can use a DLL file written in VB.NET into your application which is being developed in C#.NET. After source source code gets compiled into MSIL , JIT ( Just In Time) compiler comes into picture.

JIT Compiler: 

JIT stands for Just In Time Compiler. JIT compiler converts the MSIL code into native code or object code which is machine specific code.

Types Of JIT Compiler:

There are 3 types of JIT compiler in .net framework.

a) Pre JIT Compiler: 

    Pre JIT compiler compiles all the source code into native code in a single phase/compilation cycle. This process is done at the time when we deploy our application.

b) Econo JIT Compiler;

Econo JIT compiler compiles only those codes/methods which is requested at runtime by the runtime environment. After request is fulfilled it is removed/disposed by the Garbage Collector. That is why sometimes it is also called most economic compiler in terms of processing.

c) Normal JIT Compiler:

Normal JIT compiler is similar to Econo JIT Compiler in behaviour. It compiles methods which are required at runtime by .NET runtime environment when they are requested for First time and it has been stored in Cache. When the same method is being called/requested again then instead of recompiling the same method , compiler uses the compiled code which has been stored in cache for execution.


Here I tried to explain the details about Compiler, Interpreter and types of JIT compiler. Comments and suggestions are always welcome.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s