Compiler, Interpreter, Assembler | Introduction to Computer
Compiler, Interpreter, Assembler
Compiler, interpreter and assembler are computer language translators. So, before knowing about compiler, interpreter and assembler, one needs some knowledge on programming languages. Modern programming languages are: C, C++, Java etc.
Classification of Computer Languages: A set of written symbols that instruct the computer to perform certain tasks is known as programming language.
Machine Language: Also known as binary language. Note that machine language is nothing but, sequence of 1’s and 0’s. Machine language is the only way to directly communicates with the computer. First programmers write code as sequence of binary numbers. Writing programs in binary or machine language is tedious and error prone.
Assembly Languages: Mnemonics (symbols) are used to represent instructions. Some examples of mnemonics are: ADD, SUB, MUL, and DIV for addition, subtraction, multiplication and division respectively. Note these commands look like English statements. Main disadvantage of assembly languages are – machine dependent i.e., IBM computers have different assembly language than computers from Motorola. So, assembly language programs are different for different CPUs (i.e. machines). Writing assembly languages requires specific knowledge of computer hardware.
Note: Machine language and assembly languages are known as Low Level Languages.
High Level Languages (HLL)
HLL instructions look like human language and uses English like statements. Programs written HLL is known as source code. No detail knowledge of computer hardware is required. High Level Languages (HLL) are machine independent. This means that the programs written in HLL can be executed in ant machine. Examples of High level languages: C, C++, Pascal, COBOL, and FORTRAN.
Translation Software
Translator software is used to convert a program written in HLL and AL Programs to a form that the computer can understand. Translator software converts a program written in AL Program and HLL to a machine language program. Three different kinds of translation software are available.
An interpreter is a translator, which converts HLL programs into machine code. This process is known as interpretation. Note that the purpose of interpreter is same as that of a compiler. Interpreter is used to convert the HLL program into computer understandable form. Interpreter performs line-by-line execution of the source program, while compiler executes entire program at a time. Interpreter reads source program one line at a time, converts into machine language, executes the line, and then proceeds to the next line. If an error occurs during execution, error must be solved before it can proceed to the next line. Example of high level language program uses interpreter is BASIC.