What is Assembler?

HLASM for MVS. PL/I for MVS & Enterprise PL/I for z/OS.
Previous topicNext topic
User avatar

Topic Author
Anuj Dhawan
Founder
Posts: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

What is Assembler?

Post by Anuj Dhawan » Thu May 16, 2013 10:34 pm

Many of the "Software Engineers" I met said "assembler was a part of Computer Hardware"... :shock: !

Yes? No?

Actually, Assemblers are software, or in other words, a set of instructions that a computer uses to assemble code modules. These modules are said to run on "bare metal", meaning they are "assembled" literally into machine instructions, instead of being "compiled" or "interpreted" into machine instructions. A program that translates programs from assembly language to machine language is assembler.

Any program that is not written in machine language has to be translated in machine language before it is executed by the computer. The means used for translation are themselves computer programs. There are three types of translator programs i.e. Assembler, Compilers and Interpreters.

At this point, I'd like to talk about Assembler, Compiler, Interpreter and Linker.

Assembler:Assembler is a computer program which is used to translate program written in Assembly Language in to machine language. The translated program is called as object program. Assembler checks each instruction for its correctness and generates diagnostic messages, if there are mistakes in the program. Various steps of assembling are:
  • 1. Input source program in Assembly Language through an input device.
    2. Use Assembler to produce object program in machine language.
    3. Execute the program.
Compiler: A compiler is a program that translates a program written in HLL to executable machine language. The process of transferring HKK source program in to object code is a lengthy and complex process as compared to assembling. Compliers have diagnostic capabilities and prompt the programmer with appropriate error message while compiling a HLL program. The corrections are to be incorporated in the program, whenever needed, and the program has to be recompiled. The process is repeated until the program is mistake free and translated to an object code. Thus the job of a complier includes the following:
  • 1. To translate HLL source program to machine codes.
    2. To trace variables in the program
    3. To include linkage for subroutines.
    4. To allocate memory for storage of program and variables.
    5. To generate error messages, if there are errors in the program.
Interpreter: The basic purpose of interpreter is same as that of compiler. In compiler, the program is translated completely and directly executable version is generated. Whereas interpreter translates each instruction, executes it and then the next instruction is translated and this goes on until end of the program. In this case, object code is not stored and reused. Every time the program is executed, the interpreter translates each instruction freshly. It also has program diagnostic capabilities. However, it has some disadvantages as below:
  • 1. Instructions repeated in program must be translated each time they are executed.
    2. Because the source program is translated fresh every time it is used, it is slow process or execution takes more time. Approx. 20 times slower than complier.
Linker:The task for the linker is to grab all object files and make one executable. It uses the object files generated by the compiler and the assembler tool together with some pre-generated libraries, where some standard functions are defined. Because of the linker, you can call from one C-file functions that are defined in an other one. The linker will search the object files for finding the references.


Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.

Previous topicNext topic

Return to “Assembler & PL/I.”