Advertisements

Sunday, October 14, 2018

What is Compiler and Assembler?

As you know that High Level Language is machine independent and assembly language though it is machine dependent yet mnemonics that are being used to represent instructions are not directly understandable by machine. Hence to make the machine understand the instructions provided by both the languages, Compiler and Assembler are required to the convert these instructions into machine language.

The software (set of programs) that reads a program written in high level languages and translates it into an equivalent program in machine language is called as Compiler.

The program written by the programmer in high level language is called source program and the program generated by the compiler after translation is called as object program.

Program execution is fast once program is compiled successfully an object code file is produced. Now this object code file is executed. No need of re-compilation unless we change the source code.

Error detection and removal is comparatively difficult. Because compiler will show a list of many errors in the whole program.

Storage Allocation

Static Allocation & Dynamic Allocation

Static Allocation:-
Temporary variables, including the one used to save the return address, were also assigned fixed addresses within the program. This type of storage assignment is called static allocation.

Dynamic Allocation:-
It is necessary to preserve the previous value of any variables used by subroutine, including parameters, temporaries, return address, register save areas, etc. It can be accomplished with a dynamic storage allocation technique.


Compiler

The software (set of programs) that reads a program written in assembly language and translates it into an equivalent program in machine language is called Assembler. 

Assembler is system software which converts an assembly language program to its equivalent object code.

  • The input to the assembler is a source code written in assembly language (using machine)

and the output is an object code.

Basic Assembler functions:-
  • Translating mnemonic language to its equivalent object code.
  • Assigning machine address to symbolic labels.
Assembler