WHAT IS A COMPILER? GIVE A BRIEF NOTE ABOUT IT?
All languages have vocabulary, which is a list of words that have a specific meaning in that language. Languages also have their own grammar rules, which state the rules for combining words to form sentences. This ensures that whatever is spoken in a particular language is understood in the same way by all people who know the language. Similarly, programming languages also have a vocabulary, which is referred to as the set of keywords of that language, and a grammar, which is referred to as syntax.
Consider a scenario, where one person speaks in English with the other person. However the person who is listening understands Chinese and not English. Therefore, he calls a translator who can translate the words of English to Chinese. Similarly, computers cannot directly understand the instructions written in a programming language. Therefore, you need a translator to convert the instructions written in a programming language to machine language.
A compiler is a special program that processes the statements written in a particular programming language and converts them into machine language. Like everything else in the computer, the compiler also follows the Input Process Output cycle. It takes the programming language instructions as input. It processes these instructions to convert them to machine language. These instructions can then be executed by the computer. This process of conversion is called compilation. The following figure shows the working of a compiler.
For each programming language, there is a different compiler available. For example, to compile a program written in the C language, you require a C compiler. For a Java program, you require a Java compiler. For C# you will use csc compiler.