What is Compiler? || LN-TECHINFO

Compiler is a software program that transforms high-level source code written by a developer into a high-level programming language into a low level 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 to machine language is called Compilation.

What is compiler called

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

For some time, forget about the compiler and imagine that you have gone to a beautiful country to spend your vacation. A very basic problem in this is that you speak, write and understand only in your regional language which is Hindi. But the citizens of that country do not know anything other than English only. Then how will you communicate with others there?

In such a situation, the only solution is 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 so that you too can understand his language.

The same thing happens with a computer. Computers also understand only binary language (language which consists of 0s and 1s), while users who understand Computer as 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, there is a need for a language translator so that it can match the two.

When we do some commands 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 itself and it needs a language translator. To convert in 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 Compliers

By the way, the compiler mainly has two major parts:

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

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

What is a decompiler?

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

What is a cross-compiler?

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

What is Programming Language called

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

What is the use of compiler

Compilers are most commonly used to perform four major steps.

1. Scanning: The scanner reads one character at a time from the source code and keeps track of all the characters, which shows which character is method in which line.

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

3.  Syntactic Analysis: In this step, syntax analysis is done, which involves preprocessing which determines whether tokens that are created during lexical analysis are in proper order or not according to usage. Set of The correct order of keywords that ultimately yields a desired result is called Syntax. In this, the compiler has to check these source code so as to ensure syntactic accuracy.

4. Semantic Analysis: This step consists of several intermediate steps. First, the structure of tokens is checked in this, along with their order is also checked whether it is according to the grammar of the given language or not. The meaning of Token Structure is interpreted by parser and analyzer to finally generate an intermediate code 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 entire code is parsed and interpreted to check whether any optimizations are possible or not. Once optimizations are performed, then appropriate modified tokens are inserted into the object code so that the final object code can be generated, which is saved within the file .

What is different phases of compiler

Come here, you people know about the different phases that are being used to operate the compiler.

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

Comments