Lec-2.1 Language Processing System
Lec-2.1 Language Processing System
Expanded Code
Compiler
Assembly Code
Assembler
Object Code
Linker
Executable Code
Loader
Memory
Let us first understand how a program, using C compiler, is executed on
a host machine.
▪ User writes a program in C language (high-level language).
▪ The C compiler, compiles the program and translates it to assembly
program (low-level language).
▪ An assembler then translates the assembly program into machine
code (object).
▪ A linker tool is used to link all the parts of the program together for
execution (executable machine code).
▪ A loader loads all of them into memory and then the program is
executed.
Components of Language Processing System
1. Preprocessor
2. Compiler
3. Assembler
4. Linker
5. Loader
Preprocessor
A Preprocessor is a system software (a computer program that is
designed to run on computer’s hardware and application programs).
It performs preprocessing of the High Level Language(HLL).
Preprocessing is the first step of the language processing system.
A Preprocessor mainly performs three tasks on the HLL code :
i. Removing comments : It removes all the comments. A
comment is written only for the humans to understand
the code. So, it is obvious that they are of no use to a
machine. So, preprocessor removes all of them as they
are not required in the execution and won’t be executed
as well.
ii. File inclusion : Including all the files from library that our program
needs. In HLL we write #include which is a directive for the
preprocessor that tells it to include the contents of the library file
specified.
iii. Macro expansion : Macros can be called as small functions that are
not as overhead to process. If we have to write a function (having a
small definition) that needs to be called recursively (again and
again), then we should prefer a macro over a function. So, defining
these macros is done by preprocessor.
E.g. #define NAME Shubham
Compiler
The compiler takes the modified code as input and produces the target
code as output.
@firstcodeyt