SlideShare a Scribd company logo
1
History of compiler development
1953 IBM develops
the 701 EDPM
(Electronic Data
Processing Machine),
the first general
purpose computer,
built as a “defense
calculator” in the
2
History of compilers (cont’d)
No high-level languages were available, so all
programming was done in machine and assembly
language.
3
History of compilers (cont’d)
As expensive as these early computers were, most
of the money companies spent was for software
development, due to the complexities of assembly.
4
History of compilers (cont’d)
John Backus
In 1953, John Backus came up with the
idea of “speed coding”, and
developed the first
interpreter. Unfortunately, this
was 10-20 times slower than programs
written in assembly.
He was sure he could do better.
5
In 1954, Backus and his team released a research
paper titled “Preliminary Report, Specifications for
the IBM Mathematical FORmula TRANslating
System, FORTRAN.”
The initial release of FORTRAN was in 1956,
totaling 25,000 lines of assembly code. Compiled
programs run almost as fast as handwritten
assembly!
History of compilers (cont’d)
6
Projects that had taken two weeks to write now took
only 2 hours. By 1958 more than half of all
software was written in FORTRAN.
History of compilers (cont’d)
7
Why study compilers?
 You may never write a commercial compiler,
but that's not why we study compilers. We
study compiler construction for the following
reasons:
8
Why study compilers? (cont’d)
1) Writing a compiler gives a student experience
with large-scale applications development.
Your compiler program may be the largest
program you write as a student. Experience
working with really big data structures and
complex interactions between algorithms will
help you out on your next big programming
project
9
Why study compilers? (cont’d)
• Compiler writing is one of the shining
achievements of CS theory. It is very helpfull
in
the solutions of different problems.
10
Why study compilers? (cont’d)
3) Compiler writing is a basic element of
programming language research. Many
language researchers write compilers for the
languages they design.
11
Why study compilers? (cont’d)
4) Many applications have similar properties to
one or more phases of a compiler, and
compiler expertise and tools can help an
application programmer working on other
projects besides compilers
12
Cousins Of The Compiler
1) Preprocessor.
2) Assembler
3) Loader and Link-editor.
13
PRE-PROCESSOR
Pre-processors produce input to compilers they
might perform the following functions
I. Macro Processing
A pre-processor may allow a user define macros that
are Short hands for a longer construction,pre-processor
expand a Macros into source language statements.
14
PRE-PROCESSOR (cont’d)
II. File Inclusion
A pre-processor may include header files into the
program text.
15
PRE-PROCESSOR (cont’d)
III. Rational pre-processors
These pre-processor enhance older languages with more
modern flow of control and data structuring facilities.
For example such a pre-processor might provide the user
with built-in macros for constructs like while statements
or if-statements ,where none exits in the program language
itself.
16
PRE-PROCESSOR (cont’d)
IV. Language Extensions
These processors attempt add capabilities to the language.
For example, the language EQUEL is a database query
language embedded in C.
17
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
18
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 :
19
Assembly Code (cont’d)
Move a , R1
Add # 2 , R1
Move R1, b
20
Assembly Code (cont’d)
This code moves the contents of the address
into register 1.Then adds the constant 2 to it
and finally stores the result in the location
named b.Thus it computes
b = a+2
c=b+a
21
Two –Pass Assembler
The simplest form of assembler makes two
passes over the input, where a pass consists
of reading on input file once.In the first pass all
the identifiers that denote storage locations are
found and stored in a symbol table.Identifiers
are assigned storage locations as they are
encountered for the first time. For example ,
the symbol table might contain the entries as
follows.
22
Two –Pass Assembler (cont’d)
IDENTIFIER ADDRESS
a 0
b 4
23
Two –Pass Assembler (cont’d)
Here we have assumed that a word ,consisting
Of four bytes ,is set for each identifier,and that
Addresses are assigned starting from byte 0.
24
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.
25
3-Loaders and Link Editor
Using a program called a loader performs the Two
functions of loading and link editing.The process
of loading consists of taking relocateabl M/c
code,altering the relocatable addresses and
Placing the altered instructions and data in
memory at Proper locations.
The link editor allows us to make a Single program
from several files of relocatable m/c Code.
26
Loaders and Link Editor(cont’d)
These files may have been the result of several
different compilations and one or more may be
library files of routines provided by the system
And available to any program that need them.
27
Compilers have not changed a great deal since the
days of Backus. They still consist of two main
components:
The FRONT-END reads in the program in the
source languages, makes sense of it, and stores it in
an internal representation…
Modern Compilers
28
Modern Compilers(cont’d)
The BACK-END, which converts the internal
representation into the target language, perhaps with
optimizations. The target language used is typically
an assembly language.
29
Structure
of a
Compiler
Source Language
?
Target Language
30
Structure
of a
Compiler
Source Language
Target Language
Front End
Back End
31
Structure
of a
Compiler
Source Language
Target Language
Semantic Analyzer
Syntax Analyzer
Lexical Analyzer
Front
End
Back End
Int. Code Generator
Intermediate Code
32
Structure
of a
Compiler
Source Language
Target Language
Semantic Analyzer
Syntax Analyzer
Lexical Analyzer
Front
End
Code Optimizer
Target Code Generator
Back
End
Int. Code Generator
Intermediate Code
33
THANKS

More Related Content

PPTX
unit1_cd unit1_cd unit1_cd unit1_cd unit1_cd (1).pptx
PPTX
Compilers.pptx
PDF
Structure-Compiler-phases information about basics of compiler. Pdfpdf
PPTX
Introduction to Compilers
PPTX
4_5802928814682016556.pptx
PPTX
CD - CH1 - Introduction to compiler design.pptx
PPTX
Cd ch1 - introduction
PPTX
Embedded c c++ programming fundamentals master
unit1_cd unit1_cd unit1_cd unit1_cd unit1_cd (1).pptx
Compilers.pptx
Structure-Compiler-phases information about basics of compiler. Pdfpdf
Introduction to Compilers
4_5802928814682016556.pptx
CD - CH1 - Introduction to compiler design.pptx
Cd ch1 - introduction
Embedded c c++ programming fundamentals master

Similar to 1605557910-lecture-02 about compiler construction.ppt (20)

PDF
Lecture # 1
PPT
Cd unit i
PDF
Compiler design
PPTX
Compiler Construction Lecture One .pptx
PPT
Compiler Design Basics
PPT
Chapter One
PPTX
Chapter 1.pptx compiler design lecture note
PPTX
1 INTRODUCTION.pptxAAAAAAAAAAAAAAAAAAAAAAAAAAA
PPTX
Compiler Construction from very basic start
PPT
Introduction to C for Btech 1st year.ppt
PDF
CD NOTErvvtvvevbvtgv4tgtgtgtgtvefeveS.pdf
PDF
Compiler Design Introduction
PPT
Chap01-Intro.ppt
PPTX
Pros and cons of c as a compiler language
PPTX
Lecture 1 Introduction.pptx hfjsh huwhf uwej wiuehfi w
PDF
CS-321 Compiler Design computer engineering PPT.pdf
PPTX
Agro informatics centre up State of Lec 6.pptx
PPTX
Lecture1 compilers
PPTX
L1.1 Introduction to Programming Languages.pptx
Lecture # 1
Cd unit i
Compiler design
Compiler Construction Lecture One .pptx
Compiler Design Basics
Chapter One
Chapter 1.pptx compiler design lecture note
1 INTRODUCTION.pptxAAAAAAAAAAAAAAAAAAAAAAAAAAA
Compiler Construction from very basic start
Introduction to C for Btech 1st year.ppt
CD NOTErvvtvvevbvtgv4tgtgtgtgtvefeveS.pdf
Compiler Design Introduction
Chap01-Intro.ppt
Pros and cons of c as a compiler language
Lecture 1 Introduction.pptx hfjsh huwhf uwej wiuehfi w
CS-321 Compiler Design computer engineering PPT.pdf
Agro informatics centre up State of Lec 6.pptx
Lecture1 compilers
L1.1 Introduction to Programming Languages.pptx
Ad

More from MUhammadMiladAwan (10)

PPT
lecture 5 string in c++ explaination and example.ppt
PPTX
1606660774-connecting-devices-2 dev.pptx
PPTX
1606662359-chapter-1-top-down-network-design.pptx
PDF
CH 7 related to design and analysis of the algorithm.pdf
PDF
Computer organization and assembly language .pdf
PPTX
Assignment 1 for the students of bscs.pptx
PPT
The Floyd-Warshall of design and analysis of Algorithm.ppt
PPT
Explain the concepts of IP Addresses And Classes
PPTX
Chapter_3_Top-Down_Network_Design_Presentation.pptx
PDF
Chapter_09_OS.pdf
lecture 5 string in c++ explaination and example.ppt
1606660774-connecting-devices-2 dev.pptx
1606662359-chapter-1-top-down-network-design.pptx
CH 7 related to design and analysis of the algorithm.pdf
Computer organization and assembly language .pdf
Assignment 1 for the students of bscs.pptx
The Floyd-Warshall of design and analysis of Algorithm.ppt
Explain the concepts of IP Addresses And Classes
Chapter_3_Top-Down_Network_Design_Presentation.pptx
Chapter_09_OS.pdf
Ad

Recently uploaded (20)

PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Cloud computing and distributed systems.
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Machine Learning_overview_presentation.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
A Presentation on Artificial Intelligence
PDF
cuic standard and advanced reporting.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Big Data Technologies - Introduction.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Programs and apps: productivity, graphics, security and other tools
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation_ Review paper, used for researhc scholars
gpt5_lecture_notes_comprehensive_20250812015547.pdf
MYSQL Presentation for SQL database connectivity
Cloud computing and distributed systems.
Review of recent advances in non-invasive hemoglobin estimation
Machine Learning_overview_presentation.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Building Integrated photovoltaic BIPV_UPV.pdf
A comparative analysis of optical character recognition models for extracting...
A Presentation on Artificial Intelligence
cuic standard and advanced reporting.pdf
Spectral efficient network and resource selection model in 5G networks
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The AUB Centre for AI in Media Proposal.docx
Big Data Technologies - Introduction.pptx

1605557910-lecture-02 about compiler construction.ppt

  • 1. 1 History of compiler development 1953 IBM develops the 701 EDPM (Electronic Data Processing Machine), the first general purpose computer, built as a “defense calculator” in the
  • 2. 2 History of compilers (cont’d) No high-level languages were available, so all programming was done in machine and assembly language.
  • 3. 3 History of compilers (cont’d) As expensive as these early computers were, most of the money companies spent was for software development, due to the complexities of assembly.
  • 4. 4 History of compilers (cont’d) John Backus In 1953, John Backus came up with the idea of “speed coding”, and developed the first interpreter. Unfortunately, this was 10-20 times slower than programs written in assembly. He was sure he could do better.
  • 5. 5 In 1954, Backus and his team released a research paper titled “Preliminary Report, Specifications for the IBM Mathematical FORmula TRANslating System, FORTRAN.” The initial release of FORTRAN was in 1956, totaling 25,000 lines of assembly code. Compiled programs run almost as fast as handwritten assembly! History of compilers (cont’d)
  • 6. 6 Projects that had taken two weeks to write now took only 2 hours. By 1958 more than half of all software was written in FORTRAN. History of compilers (cont’d)
  • 7. 7 Why study compilers?  You may never write a commercial compiler, but that's not why we study compilers. We study compiler construction for the following reasons:
  • 8. 8 Why study compilers? (cont’d) 1) Writing a compiler gives a student experience with large-scale applications development. Your compiler program may be the largest program you write as a student. Experience working with really big data structures and complex interactions between algorithms will help you out on your next big programming project
  • 9. 9 Why study compilers? (cont’d) • Compiler writing is one of the shining achievements of CS theory. It is very helpfull in the solutions of different problems.
  • 10. 10 Why study compilers? (cont’d) 3) Compiler writing is a basic element of programming language research. Many language researchers write compilers for the languages they design.
  • 11. 11 Why study compilers? (cont’d) 4) Many applications have similar properties to one or more phases of a compiler, and compiler expertise and tools can help an application programmer working on other projects besides compilers
  • 12. 12 Cousins Of The Compiler 1) Preprocessor. 2) Assembler 3) Loader and Link-editor.
  • 13. 13 PRE-PROCESSOR Pre-processors produce input to compilers they might perform the following functions I. Macro Processing A pre-processor may allow a user define macros that are Short hands for a longer construction,pre-processor expand a Macros into source language statements.
  • 14. 14 PRE-PROCESSOR (cont’d) II. File Inclusion A pre-processor may include header files into the program text.
  • 15. 15 PRE-PROCESSOR (cont’d) III. Rational pre-processors These pre-processor enhance older languages with more modern flow of control and data structuring facilities. For example such a pre-processor might provide the user with built-in macros for constructs like while statements or if-statements ,where none exits in the program language itself.
  • 16. 16 PRE-PROCESSOR (cont’d) IV. Language Extensions These processors attempt add capabilities to the language. For example, the language EQUEL is a database query language embedded in C.
  • 17. 17 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
  • 18. 18 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 :
  • 19. 19 Assembly Code (cont’d) Move a , R1 Add # 2 , R1 Move R1, b
  • 20. 20 Assembly Code (cont’d) This code moves the contents of the address into register 1.Then adds the constant 2 to it and finally stores the result in the location named b.Thus it computes b = a+2 c=b+a
  • 21. 21 Two –Pass Assembler The simplest form of assembler makes two passes over the input, where a pass consists of reading on input file once.In the first pass all the identifiers that denote storage locations are found and stored in a symbol table.Identifiers are assigned storage locations as they are encountered for the first time. For example , the symbol table might contain the entries as follows.
  • 22. 22 Two –Pass Assembler (cont’d) IDENTIFIER ADDRESS a 0 b 4
  • 23. 23 Two –Pass Assembler (cont’d) Here we have assumed that a word ,consisting Of four bytes ,is set for each identifier,and that Addresses are assigned starting from byte 0.
  • 24. 24 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.
  • 25. 25 3-Loaders and Link Editor Using a program called a loader performs the Two functions of loading and link editing.The process of loading consists of taking relocateabl M/c code,altering the relocatable addresses and Placing the altered instructions and data in memory at Proper locations. The link editor allows us to make a Single program from several files of relocatable m/c Code.
  • 26. 26 Loaders and Link Editor(cont’d) These files may have been the result of several different compilations and one or more may be library files of routines provided by the system And available to any program that need them.
  • 27. 27 Compilers have not changed a great deal since the days of Backus. They still consist of two main components: The FRONT-END reads in the program in the source languages, makes sense of it, and stores it in an internal representation… Modern Compilers
  • 28. 28 Modern Compilers(cont’d) The BACK-END, which converts the internal representation into the target language, perhaps with optimizations. The target language used is typically an assembly language.
  • 31. 31 Structure of a Compiler Source Language Target Language Semantic Analyzer Syntax Analyzer Lexical Analyzer Front End Back End Int. Code Generator Intermediate Code
  • 32. 32 Structure of a Compiler Source Language Target Language Semantic Analyzer Syntax Analyzer Lexical Analyzer Front End Code Optimizer Target Code Generator Back End Int. Code Generator Intermediate Code

Editor's Notes

  • #12: 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. The preprocessor is executed before the actual compilation of code begins, therefore the preprocessor digests all these directives before any code is generated by the statements.
  • #13: Macro is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to a replacement output sequence Macros are used to make a sequence of computing instructions available to the programmers as a single program statement, making the programming task less tedious and less error-prone. (Thus, they are called "macros" because a big block of code can be expanded from a small sequence of characters.)
  • #17: when machine code is generated then the computer does not where the code will be placed at ram till run time . so numbers all the line from 0-1-2.. so on. now suppose your program loaded at 230 address then this address on run time will be converted to 230+0,230+1,230+2 means every line will just adjust acordingly . this type of address is call relocatable address as we have to relocate the address it is a part of run time binding. whereas if i came to know at compile time hat at what frame my program will be loading like i came to know my program will load at 530. i will make all my line to start with 530. so that no address change will be required . so that is called absolute machine code . also know as compile time binding.
  • #24: when machine code is generated then the computer does not where the code will be placed at ram till run time . so numbers all the line from 0-1-2.. so on. now suppose your program loaded at 230 address then this address on run time will be converted to 230+0,230+1,230+2 means every line will just adjust acordingly . this type of address is call relocatable address as we have to relocate the address it is a part of run time binding.