Compiler in C
A compiler is a system software which converts programming language code into binary format in single steps.
In other words compiler is a system software which can take input form other any programming language and convert it into lower level machine dependent language.
It is a program which translates the human readable code to a language a computer process understands ( binary 1 and 0 bits ) . The computer processes the machine code to perform the corresponding task.
Role of compiler
- Compiles reads the source code, outputs executable code.
- Translates software written in a higher level language into instructions that computer can understand. It converts the text that programmer writes into format the CPU can understand.
- The process of compilation is relatively complicated . It spends a lot of time analyzing and processing the program,
- The executable result is some form of machine specific binary code.
Interpreter
It is system software which is used to convert high level programming language into machine code. This includes source code, pre-compiled code and scripts. Both compiler and interpreters do the same job which is converting high level language to machine code. However, a compiler will convert the code into machine code (create exe file )before program run. Interpret code convert into machine code when the program is running.
It actually translate single statement of source program into machine code by language process and executed it immediately before moving on to the next line . If there is an error in statement, the interpreter terminates its translating process at the statement and displays an error massage. The interpreter moves on to the next line for execution only after removal of the error . An interpreter directly executes instructions written in a programming or scripting language without previously converting then to an object code or machine code.
Role of Interpreter
- The interpreter converts the source code line by line during RUN time.
- Interpret completely translates a program written in a hign level language into machine level language.
- Interpreter allows evaluation and modification of the program while it is executing .
- Relatively less time spent for analyzing and processing the program .
- Program execution is relatively slow compared to compiler.
You may also like -
Difference between compiler and interpreter
Key differences between compiler and interpreter -
- Compiler transforms code written in a high level programming language into the machine code, at once, before program runs. Whereas an interpreter converts each high level programming statement, one by one, into the machine code, during program run .
- Compiled code runs faster while interpreted code rules slower .
- Compiler displays all errors after compilation, on the other hand, the interpreter displays errors of each line one by one .
- Compiler is based on translation linking - loading model, whereas interpreter is based on interpretation Method.
- Compiler takes an entire program whereas the interpreter takes a single line of code.
Assembler
An assembler is system software which is used to convert the assembly language instruction into binary format in step by step process. The source program is a input of assembler that contains assembly language instructions. The output generated by assembler is the object code or machine code understandable by the computer.
0 Comments