Compiler is a computer program that translates any computer code from one programming language to another.
Do you know What is Compiler? 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 such 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 people about what is the work 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 that who is the compiler and how it works.
- 1 What is Compiler
- 2 what is the use of compiler
What is Compiler
One Compiler A software program that transforms high-level source code written by a developer into a high-level programming language in her 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 into machine language is called Compilation.
who is the compiler
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 one non-technical 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, there is a need for a language translator 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 In etc. which is in English only and a Language Translator is needed to convert it 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 Compliers
By the way, there are mainly two major parts of the compiler:
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 Analyzer.
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?
Such 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: these The 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: The 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 called a program. 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.
3. Syntactic Analysis: In this step, syntax analysis is done, which involves preprocessing, which determines whether the tokens that 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 a 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
What is Compiler and Interpreter?
compiler There is a kind of translator that converts the source language into the language of the object. interpreter It is a kind of program that works only in the source language.
What do you understand by compiler?
Compiler is a type of translator program.
Which software is the compiler?
compiler There is such a program. Which translates the program written in a high-level language into the machine language of the computer.
what did you learn today
I hope you like this article of mine What is Compiler Must have liked it. It has always been my endeavor to provide complete information to the readers about what is the use of the compiler so that they can be accessed from other sites or websites. There is no need to search in the context of that article in the internet.
This will also save their time and they will also get all the information in one place. If you have any doubts about this article or you want that there should be some improvement in it, then you can write low comments for this.
If you liked this post what is the work of the compiler in Hindi or got to learn something, then please share this post on social networks such as Share on Facebook, Twitter etc.