0% found this document useful (1 vote)
344 views

Assembler: Cousins of Compiler

The preprocessor processes input data and produces output for other programs like compilers. It performs tasks like macro processing, file inclusion, rational preprocessing and language extension. The assembler translates assembly mnemonics into machine code. There are one-pass and two-pass assemblers. The linker combines object files into a single executable by resolving references and determining memory locations. The loader loads programs into memory, which is essential for starting a program.

Uploaded by

Muhammad Fayaz
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
344 views

Assembler: Cousins of Compiler

The preprocessor processes input data and produces output for other programs like compilers. It performs tasks like macro processing, file inclusion, rational preprocessing and language extension. The assembler translates assembly mnemonics into machine code. There are one-pass and two-pass assemblers. The linker combines object files into a single executable by resolving references and determining memory locations. The loader loads programs into memory, which is essential for starting a program.

Uploaded by

Muhammad Fayaz
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Cousins of Compiler

1. Preprocessor
2. 2. Assembler
3. Loader and Link-edito
Preprocessor:

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
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 represent as a macro
into a specific output sequence is known as macro
expansion.
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.
 
• Rational Preprocessors :
• These processors change older languages with more
modern flow-of-control and data-structuring facilities.

• 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
• Assembler creates object code by translating assembly
instruction mnemonics into machine code.
• There are two types of assemblers:

One-pass 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: 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
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.

You might also like