What is Compiler? What is the use of compiler?

0
48

Do you know what a compiler is ? If not then this is a great opportunity for you to understand this technology easily. Whether you are a technical student or from a non-tech background, it is for the good of everyone to understand this compiler. 

Because it is used everywhere. by the way one For a computer science student, it is very important to understand this. 

Because if you want to understand fully about programming, then it becomes very important to know about what is the function of the compiler.

By the way, if I say a compiler in easy language, then it is a program that converts a source language into a target language as per the requirement. 

This high level language in a computer Converts to Machine Language . That’s why today I thought that why should I provide complete information to you about what is the function of the compiler, so that in the coming time, you should already be aware of this basic technology. 

So without delay, let’s start and know what the compiler is called and how it works.

What is Compiler

A compiler is a software program that transforms high-level source code written by a developer into a high-level programming language .

Object code ( binary code ) in machine language, and which can be easily shared by the processor . 

This process in which high-level programming is converted into machine language is called Compilation.

Also Read:   What Is ATM (Automatic Teller Machine)? What Are Advantages & Disadvantages Of ATM?

As I have already introduced you to the technical definition of Compiler, as everyone often does, but now I am going to explain to you the definition of Compiler in very easy language so that a non-technica l person can also understand.

Forget about the compiler for some time and imagine that you have gone to a beautiful country to spend your vacation. 

There is a very basic problem in this that you can speak, write and understand only in your regional language which is Hindi. But there the citizens of that country know nothing but English only. Then how will you communicate with others there?

In such a situation, there is only one solution for this that you will need a language translator which can be a human or a book or even an App. 

This language translator will translate your Hindi into English so that the other person can understand your words. Together he will convert English into Hindi as well till you can understand his language.

The same thing happens with computers. Computers also understand only binary language (language which contains 0s and 1s), whereas users who understand computer understand English or any language. 

In such a situation, how will the computer understand the commands given by you? Also, you will not understand any process calculation performed by the computer. In such a situation, a language translator is needed here so that he can have a good balance between the two.

When we give some command to the computer to process, then we write some set of instructions-program in English language like c, c++, java etc. which is in English only and a language translator is needed.

Also Read:   Guaranteed Return Pension Scheme: PFRDA Said That It Is Preparing To Introduce A Pension Scheme That Guarantees Minimum Returns.

To convert into binary language so that a computer can understand it easily. In such a situation, Complier is used in this place, which converts high level language into machine language.

What are the Major Parts of Compilers?

By the way, there are mainly two major parts of the compiler:

Analysis Phase

The first part is the analysis phase, in which an intermediate representation is created from a given source program. The main parts of this phase are – Lexical Analyzer, Syntax Analyzer and Semantic Analyze.

Synthesis Phase

Whereas the second part is the synthesis phase, in which the equivalent target program is created from the intermediate representation. The main parts of this phase are – Intermediate Code Generator, Code Generator, and Code Optimizer.

What is Decompiler?

A compiler that converts machine language into high-level natural language is called a decompiler.

What is a Cross-Compiler?

Compilers which produce object code which is made to run only in the system are called Cross-Compilers.

What is Programming Language?

A compiler that converts one programming language to another is called a language translator.

What is the use of compiler?

Compilers are most commonly used to perform four major steps.

1. Scanning: Scanner reads one character at a time from the source code and keeps track of all the characters so that it knows which character is present in which line.

2.  Lexical Analysis: Compiler converts the sequence of characters that appear in the source code into a series of strings of characters (called key tokens), which are associated with a specific rule of a program. by whom a lexical analyzer. a symbol table is used to store the words in the lexical analyzer in the source code which corresponds with the token generated.

Also Read:   What Is Hardware? - What Is Computer Hardware?

3.  Syntactic Analysis: In this step, syntax analysis is done, which involves pre-processing which determines whether the tokens which are created during lexical analysis are in proper order or not according to usage. Set of the correct order of keywords which finally yields a desired result is called Syntax. In this, the compiler has to check this source code so that syntactic accuracy can be ensured.

4. Semantic Analysis:There are many intermediate steps in this step. First, in this the structure of tokens is checked, along with their order is also checked whether it is according to the grammar of the given language or not. The meaning of the token structure is interpreted by the parser and analyzer so that finally an intermediate code can be generated which is called Object code. These object codes contain instructions that represent the processor action for a corresponding token when it is encountered in the program. Finally, the entire code is parsed and interpreted to check whether any optimizations are possible or not. Once the optimizations are performed, then appropriate modified tokens are inserted into the object code to generate the final object code, which is saved within the file .

What are the Different Phases of Compiler?

Let us let you know about the different phases being used to operate the compiler here.

1.  Lexical Analysis
2.  Synatx Analysis
3.  Semantic Analysis
4.  Intermediate Code Generator
5.  Code optimizer
6.  Code generation

Previous articleForeign Exchange Market Rate Of Dollar-Rupee On Today 15 July 2021
Next articleWhat Is ATM (Automatic Teller Machine)? What Are Advantages & Disadvantages Of ATM?

LEAVE A REPLY

Please enter your comment!
Please enter your name here