Professional Documents
Culture Documents
Lect 02
Lect 02
Lect 02
calculator” in the
1
History of compilers (cont’d)
2
History of compilers (cont’d)
3
History of compilers (cont’d)
4
History of compilers (cont’d)
5
History of compilers (cont’d)
6
Why study compilers?
7
Why study compilers? (cont’d)
8
Why study compilers? (cont’d)
9
Why study compilers? (cont’d)
10
Why study compilers? (cont’d)
11
Cousins Of The Compiler
1) Preprocessor.
2) Assembler
3) Loader and Link-editor.
12
PRE-PROCESSOR
14
PRE-PROCESSOR (cont’d)
15
PRE-PROCESSOR (cont’d)
16
2-ASSEMBLERS
Some compiler produce assembly code that is passed to an
Assembler for further processing. Other compiler perform the
Job of the assembler ,producing relocatable machine code
That can be passed directly to the loader /link –editor
17
Assembly Code
Assembly code is a mnemonic version of machine code ,in
Which names are used instead of binary code for operation
And names are also given to memory addresses. A typical
Sequence of assembly instruction might be :
18
Assembly Code (cont’d)
Move a , R1
Add # 2 , R1
Move R1, b
19
Assembly Code (cont’d)
b = a+2
20
Two –Pass Assembler
21
Two –Pass Assembler (cont’d)
IDENTIFIER ADDRESS
a 0
b 4
22
Two –Pass Assembler (cont’d)
23
Two –Pass Assembler (cont’d)
Second pass
In the second pass ,the assembler scans the
input Again.This time it translates each
operation code into the sequence of bits
representing a location into the address given
for the identifier in the symbol table. The output
of the 2nd pass is usually relocatable m/c code.
24
3-Loaders and Link Editor
25
Loaders and Link Editor(cont’d)
26
Modern Compilers
27
Modern Compilers(cont’d)
28
Source Language
Structure
of a
Compiler
?
Target Language
29
Source Language
Structure
of a Front End
Compiler
Back End
Target Language
30
Source Language
Lexical Analyzer
Back End
Target Language
31
Source Language
Lexical Analyzer
Target Language
32
THANKS
33