1A With A Neat Diagram Explain The Various

Question

1A. With a neat diagram, explain the various components of language processing 3M system

1A. With a neat diagram, explain the various components of language processing 3M system

Solutions

Expert Solution

We needed a system that helps us to program in our own language
and execute it . But since the system cannot understand this
language, we need a mechanism which converts the high level
language that we program with to a machine level program and
execute it. On this high level language program, we may be using
tools or modules that are residing outside this program therefore
we also need to include these files to our code. The system that
does this task is known as language processing system. There are
many steps involved in this other than specified above. We look
into the components of language processing system and explain
each.

Note : Source program is not a component. We can say it as an
input to the system. (Source program is the program that we code in
high level language)

Pre processor :

Input :Source program

Output :Source program

The source program is first handled by the pre processor. It
import/include different other program/program segments or modules
to have a complete environment so that the source program can
run.Therefor the pre processor will convert our source program into
a different version of source program. The best example for this
the include statements that we write above C/C++ and using the
functions defined in those libraries. In C/C++ any statement
started with '#' is handled by pre processor. The examples are
macros (using #define). Consider a statement # define pi 3.14. The
pre processor replace all the occurrences of the of pi in code with
3.14

Compiler:

Input :Source program

Output :Assembly code

The compiler do the compilation. Compilation is defined as the
process of translating one language to other. Here the compiler
will translate the given source code into a target assembly
language. There are many benefits for doing this. The most
important benefit is easiness. Assembly language are easy to debug.
In most of the time code optimization is also done in assembly
code.

Assembler:

Input :Assembly code

Output :Relocatable Machine code

It will convert the assembly code (from compiler) to actual
executable code.

Now the important question comes…, If it assembler returns the
executable code, then what is Linker/Loader.

In machine language, the address for each module will be in
relocatable machine code format. This is done so that even if we
change one module, we don't have to re write the entire code. We
just have to locate the address to new written module. Therefore
the actual output of assembler is not machine code, but a
relocatable machine code. This is given as input to
Linker/Loader

Linker/Loader:

Input Linker :Relocatable machine code

Output Linker :Target machine code

The linker will link each and every module of program to other
some other modules or modules whose definitions are written
outside. So different modules will get linked so that the program
will become ultimately an executable one. It will also create an
header to the target program so that when the program gets
executed, then from the header part of the program, the Operating
System can get the required information and do the needful loading.
Then Loader will come into play. When the program will be asked for
execution, each and every program is requiring some memory space to
get loaded. The loader will check for available memory blocks,
where the program can get loaded and can have its smooth execution.
Therefore, in the end, linker will returns the target machine code
which will be loaded by loader prior to execution.


Submit Your Answer

[contact-form-7 id=”5″ html_class=”cf7_custom_style_1″ title=”Answer Question”]