![if !IE]> <![endif]>
COUSINS OF COMPILER
1. Preprocessor 2. Assembler 3. Loader and Link-editor
A preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers.
They may perform the following functions :
1. Macro processing 3. Rational Preprocessors
2. File Inclusion 4. Language extension
1. Macro processing:
A macro is a rule or pattern that specifies how a certain input sequence should be mapped to an output sequence according to a defined procedure. The mapping process that instantiates a macro into a specific output sequence is known as macro expansion.
2. File Inclusion:
Preprocessor includes header files into the program text. When the preprocessor finds an #include directive it replaces it by the entire content of the specified file.
3. Rational Preprocessors:
These processors change older languages with more modern flow-of-control and data-structuring facilities.
4. Language extension :
These processors attempt to add capabilities to the language by what amounts to built-in macros. For example, the language Equel is a database query language embedded in C.
Assembler creates object code by translating assembly instruction mnemonics into machine code. There are two types of assemblers:
· One-pass assemblers go through the source code once and assume that all symbols will be defined before any instruction that references them.
· Two-pass assemblers create a table with all symbols and their values in the first pass, and then use the table in a second pass to generate code
Fig. 1.7 Translation of a statement
Linker and Loader
A linker or link editor is a program that takes one or more objects generated by a compiler and combines them into a single executable program. Three tasks of the linker are
1.Searches the program to find library routines used by program, e.g. printf(), math routines.
2. Determines the memory locations that code from each module will occupy and relocates its instructions by adjusting absolute references 3. Resolves references among files.
A loader is the part of an operating system that is responsible for loading programs in memory, one of the essential stages in the process of starting a program.
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.