Cousins of Compiler
Cousins of Compiler
Cousins of Compiler
Compiler Construction
[SWE-310]
Cousins of a Compiler
Preprocessors
Assemblers
1
8/5/2020
a) Preprocessor:
Macro Processing:
• Define macros that are short hands for larger
constructs.
• E.g. #define PI 3.14
2
8/5/2020
File Inclusion:
• Inclusion of header files into program text.
• i.e. #include <stdio.h>
Rational Preprocessors:
• Augment older languages with more modern
flow of control and data structuring facilities.
Language Extensions:
• Attempts to add capabilities to the language
by associating more built-in macros.
• E.g.#1 Inclusion of Assembly code by using
asm: directive.
• E.g.#2 Inclusion of database query language
Equel by using ##: directive in C language.
3
8/5/2020
4
8/5/2020
A loader performs;
• Loading
• Link-editing
The loading refers to taking relocatable machine
code, altering it and placing the altered instruction
and data in memory at proper locations.
The link-editor allows to make a single program
from several files of relocatable machine code.
i.e. The inclusion of library files (<stdio.h> or
<conio.h>) or external routines.
5
8/5/2020
Parser Generators:
Produce Syntax Analyzers based on context
free grammar.
Scanner Generators:
Generates lexical analyzers from a specification
based on regular expression.
The resulting lexical analyzer is basically a finite
automaton.