SlideShare a Scribd company logo
Lecture # 1
Compiler Construction
2
Texts:
Compiler Construction Principles and Practice
by Kenneth C. Louden
Compilers
by Afred, Jaffery Ulman
Introduction
3
4
A Compiler is a program that Reads one
Language (Source Code) and Translate it into
an equivalent another Language (Target Code)
CompilerSource Code Target Code
5
Source Code
usually in a high-level language,
e.g. C++, JAVA, VB, FORTAN, PASCAL, etc.
Target Code
usually in machine language (object code) or
assembly language (assembly code).
6
Thus a Compiler specifically is an executable
program that Reads a source code written in
usually some high-level language and Translates it
into an equivalent object code (machine language)
or assembly code (assembly language)
Compiler
code in
high-level
language
outputExecutable program
in machine language
executable program
in machine code or
assembly code
input
Definition
Complexity
A compiler may be a complex from program from
10,000 to 100,000 lines of source code.
7
Uses
compiler construction techniques have a large scope of
applications and these are used almost in every
field of computer sciences.
8
Our Task ?
Our task is to understand the basic organization,
structure and operations of a compiler.
9
Prerequisites
 Data Structures
 Discrete Mathematics
 Programming Languages
 Computer Architectures
 Assembly Languages
 Automata Theory (most helpful)
10
Design Issues
Programming Language Design issues are actually
Based on Language Design Issues so will discuss
the both ones.
11
Why Compiler ?
The Background
12
Machine Language
With the advent of Stored Program Computer in
late 1940’s by John Von Neumann, it was time
To write Computer Programs (sequence of steps),
that needed a Compiler to interpret these
Programs.
Initially these programs were written in the actual
Machine Codes.
exp.
Task: move a number 2 to memory location 0000.
Machine Code Instruction c7 06 0000 0002
13
Programming was much difficult in such language
thus a symbolic language was introduced, and that
language is called Assembly Language
exp.
Task: move a number 2 to memory location 0000.
Machine Code Instruction: c7 06 0000 0002
Assembly Code Instruction: move x , 2
where x is symbolic memory location.
14
Assembly Language
Machine Dependency
Difficult to Read (understand) & Write
15
Drawbacks
The next step in programming was the advent of
high level languages, exp.
Task: move a number 2 to memory location 0000.
Machine Code Instruction: c7 06 0000 0002
Assembly Code Instruction: move x , 2
High Level Instruction: x = 2 ;
16
High Level Language
Machine Independency
Easy to Read (understand) & Write
Close to human nature
mathematically & logically
17
Advantages
FORTRAN (1954 - 1957)
FORTRAN was the first high level language
developed in 195- 1954
Thus the first compiler for FORTRAN was
developed by the team at IBM led by John Backus
between 1954 and 1957.
18
Noam Chomsky
When the first compiler was under construction
during 195- 1954, Noam Chomsky was working on
the structure of Natural Languages
Chomsky’s research work also helped the
construction of first compiler.
19
Chomsky Hierarchy
Chomsky classified the languages according to the
complexity of their grammar
These Hierarchies are;
Type 0
Type 1
Type 2
Type 3
Where each next type is an advance form of their
previous type.
20
Parsing Problem
The next step in the development of compilers
was the study of parsing problem during 1960 to
1970,
During that study CFL and the problem to find out
efficient algorithms for the recognition of CFL
were studied.
21
Recent Work
Currently scientists are continuously working and
trying to find efficient methods of object code
generation. Its really difficult to generate truly
optimal code, but they only increase its efficiency.
Similarly work is being on the automation of
different phases, i.e., scanner generators, parser
Generators, etc.
22
Recent Work
Scientists are also working to develop
different sophisticated algorithms for pre analysis
of source code, like Unification Algorithm
Development of more enhanced and rich window
based IDE’s
Standardization of such environments.
etc,
23
(1) for development of new languages.
- language extensions & improvement
- more rich/formal specification of languages
- development of 4th generation languages
(2) for Standardization of Construction Process.
(3) for parallelizing compilers & related tools.
(4) for new development platforms.
24
Importance
(5) theories learned in this course are applicable to
other fields
e.g.,
prototyping tools,
database languages
text formatter
FSM (Finite State Machine) translator
query interpreter
command line interpreter
interface programs
Silicon Compilers, etc.
(6) for improving capabilities of existing
compiler/interpreter
25
Silicon compiler
- A silicon compiler is a software system that takes a
user's specifications and automatically generates an
integrated circuit (IC). The process is sometimes
referred to as hardware compilation.
- Source language: conventional programming
language
- Variables
Represents not the location but logical signals (0 or 1)
or groups of signals in a switching circuit.
- Output : circuit design in an appropriate language
26
Assignment # 1
27

More Related Content

PPTX
Introduction to C Language
PPT
Introduction to c_language
PPTX
1 introduction to c programming language
PPTX
Introduction to c language
PPTX
Programming language
PPTX
Introduction to C Language
PPT
Comparative Study of programming Languages
PPT
Programming assignment help
Introduction to C Language
Introduction to c_language
1 introduction to c programming language
Introduction to c language
Programming language
Introduction to C Language
Comparative Study of programming Languages
Programming assignment help

What's hot (20)

PPT
PROGRAMMING LANGUAGES
PPSX
Introduction of c language
PPTX
Programming landuages
PPTX
generation of programming language
PPSX
Programming Fundamental Presentation
PPT
Generations of Programming Languages
PPT
Programing Language
PPTX
Programming languages
PPTX
Introduction of c programming
PPTX
Computer Programming Overview
PPTX
Theory of programming
PPTX
introduction to c programming language
DOCX
C Unit 1 notes PREPARED BY MVB REDDY
PPTX
Program & language generation
PPT
Generations of Programming Languages
PPTX
Evolution of Computer Languages
PPTX
Generations of programming_language.kum_ari11-1-1-1
PPT
Lect 1. introduction to programming languages
PPT
Generations Of Programming Languages
PPT
Presentation on Programming Languages.
PROGRAMMING LANGUAGES
Introduction of c language
Programming landuages
generation of programming language
Programming Fundamental Presentation
Generations of Programming Languages
Programing Language
Programming languages
Introduction of c programming
Computer Programming Overview
Theory of programming
introduction to c programming language
C Unit 1 notes PREPARED BY MVB REDDY
Program & language generation
Generations of Programming Languages
Evolution of Computer Languages
Generations of programming_language.kum_ari11-1-1-1
Lect 1. introduction to programming languages
Generations Of Programming Languages
Presentation on Programming Languages.
Ad

Similar to Lecture # 1 (20)

DOCX
all languages in computer programming
PPTX
Basic programming concepts
PPTX
Compiler Construction Lecture One .pptx
PPTX
Introduction To Computer Programming
PPTX
History of Computer Programming Languages.pptx
PDF
Introduction to compiler development
PPT
English de lenguaje de programacion
PPTX
Programming languages
PPT
Introduction to Computer
PPTX
Chapter-4.pptx introduction to computing CC1/L
PPT
Introduction Programming Languages
PDF
Programming language evolution and paradigm
PPTX
Why-Kotlin definition to understand the use of kotin
PPTX
Plc part 1
PPTX
Lesson 1-3 Fundamentals of Programming.pptx
PPT
Software Engineering : Computer basics - Introduction to computer
PPTX
Presentation of the Computer language.pptx
PPTX
Code learning
PPTX
Programming lesson1
all languages in computer programming
Basic programming concepts
Compiler Construction Lecture One .pptx
Introduction To Computer Programming
History of Computer Programming Languages.pptx
Introduction to compiler development
English de lenguaje de programacion
Programming languages
Introduction to Computer
Chapter-4.pptx introduction to computing CC1/L
Introduction Programming Languages
Programming language evolution and paradigm
Why-Kotlin definition to understand the use of kotin
Plc part 1
Lesson 1-3 Fundamentals of Programming.pptx
Software Engineering : Computer basics - Introduction to computer
Presentation of the Computer language.pptx
Code learning
Programming lesson1
Ad

Recently uploaded (20)

PDF
Classroom Observation Tools for Teachers
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Updated Idioms and Phrasal Verbs in English subject
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
Cell Types and Its function , kingdom of life
Classroom Observation Tools for Teachers
Microbial diseases, their pathogenesis and prophylaxis
What if we spent less time fighting change, and more time building what’s rig...
Yogi Goddess Pres Conference Studio Updates
Microbial disease of the cardiovascular and lymphatic systems
History, Philosophy and sociology of education (1).pptx
RMMM.pdf make it easy to upload and study
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Updated Idioms and Phrasal Verbs in English subject
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
01-Introduction-to-Information-Management.pdf
Final Presentation General Medicine 03-08-2024.pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Cell Types and Its function , kingdom of life

Lecture # 1

  • 2. Compiler Construction 2 Texts: Compiler Construction Principles and Practice by Kenneth C. Louden Compilers by Afred, Jaffery Ulman
  • 4. 4 A Compiler is a program that Reads one Language (Source Code) and Translate it into an equivalent another Language (Target Code) CompilerSource Code Target Code
  • 5. 5 Source Code usually in a high-level language, e.g. C++, JAVA, VB, FORTAN, PASCAL, etc. Target Code usually in machine language (object code) or assembly language (assembly code).
  • 6. 6 Thus a Compiler specifically is an executable program that Reads a source code written in usually some high-level language and Translates it into an equivalent object code (machine language) or assembly code (assembly language) Compiler code in high-level language outputExecutable program in machine language executable program in machine code or assembly code input Definition
  • 7. Complexity A compiler may be a complex from program from 10,000 to 100,000 lines of source code. 7
  • 8. Uses compiler construction techniques have a large scope of applications and these are used almost in every field of computer sciences. 8
  • 9. Our Task ? Our task is to understand the basic organization, structure and operations of a compiler. 9
  • 10. Prerequisites  Data Structures  Discrete Mathematics  Programming Languages  Computer Architectures  Assembly Languages  Automata Theory (most helpful) 10
  • 11. Design Issues Programming Language Design issues are actually Based on Language Design Issues so will discuss the both ones. 11
  • 12. Why Compiler ? The Background 12
  • 13. Machine Language With the advent of Stored Program Computer in late 1940’s by John Von Neumann, it was time To write Computer Programs (sequence of steps), that needed a Compiler to interpret these Programs. Initially these programs were written in the actual Machine Codes. exp. Task: move a number 2 to memory location 0000. Machine Code Instruction c7 06 0000 0002 13
  • 14. Programming was much difficult in such language thus a symbolic language was introduced, and that language is called Assembly Language exp. Task: move a number 2 to memory location 0000. Machine Code Instruction: c7 06 0000 0002 Assembly Code Instruction: move x , 2 where x is symbolic memory location. 14 Assembly Language
  • 15. Machine Dependency Difficult to Read (understand) & Write 15 Drawbacks
  • 16. The next step in programming was the advent of high level languages, exp. Task: move a number 2 to memory location 0000. Machine Code Instruction: c7 06 0000 0002 Assembly Code Instruction: move x , 2 High Level Instruction: x = 2 ; 16 High Level Language
  • 17. Machine Independency Easy to Read (understand) & Write Close to human nature mathematically & logically 17 Advantages
  • 18. FORTRAN (1954 - 1957) FORTRAN was the first high level language developed in 195- 1954 Thus the first compiler for FORTRAN was developed by the team at IBM led by John Backus between 1954 and 1957. 18
  • 19. Noam Chomsky When the first compiler was under construction during 195- 1954, Noam Chomsky was working on the structure of Natural Languages Chomsky’s research work also helped the construction of first compiler. 19
  • 20. Chomsky Hierarchy Chomsky classified the languages according to the complexity of their grammar These Hierarchies are; Type 0 Type 1 Type 2 Type 3 Where each next type is an advance form of their previous type. 20
  • 21. Parsing Problem The next step in the development of compilers was the study of parsing problem during 1960 to 1970, During that study CFL and the problem to find out efficient algorithms for the recognition of CFL were studied. 21
  • 22. Recent Work Currently scientists are continuously working and trying to find efficient methods of object code generation. Its really difficult to generate truly optimal code, but they only increase its efficiency. Similarly work is being on the automation of different phases, i.e., scanner generators, parser Generators, etc. 22
  • 23. Recent Work Scientists are also working to develop different sophisticated algorithms for pre analysis of source code, like Unification Algorithm Development of more enhanced and rich window based IDE’s Standardization of such environments. etc, 23
  • 24. (1) for development of new languages. - language extensions & improvement - more rich/formal specification of languages - development of 4th generation languages (2) for Standardization of Construction Process. (3) for parallelizing compilers & related tools. (4) for new development platforms. 24 Importance
  • 25. (5) theories learned in this course are applicable to other fields e.g., prototyping tools, database languages text formatter FSM (Finite State Machine) translator query interpreter command line interpreter interface programs Silicon Compilers, etc. (6) for improving capabilities of existing compiler/interpreter 25
  • 26. Silicon compiler - A silicon compiler is a software system that takes a user's specifications and automatically generates an integrated circuit (IC). The process is sometimes referred to as hardware compilation. - Source language: conventional programming language - Variables Represents not the location but logical signals (0 or 1) or groups of signals in a switching circuit. - Output : circuit design in an appropriate language 26