SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
Compilers
CS 346
3 – 0 – 0 – 6
Monday – Tuesday – Wednesday
9.00 --- 9.55 10.00 --- 10.55 11.00 --- 11.55
Arijit Sur
Office: H-103
Department of Computer Science and Engineering
Email: arijit@iitg.ernet.in
Ph: 2361
Instructors: Dr. A. Sur and Dr. A. Sarkar
Syllabus
‱ Overview of different phases of a compiler: front-end; back-end;
‱ Lexical analysis: specification of tokens, recognition of tokens, input
buffering, automatic tools;
‱ Syntax analysis: context free grammars, top down and bottom up parsing
techniques, construction of efficient parsers, syntax-directed translation,
automatic tools;
‱ Semantic analysis: declaration processing, type checking, symbol tables,‱ Semantic analysis: declaration processing, type checking, symbol tables,
error recovery;
‱ Intermediate code generation: run-time environments, translation of
language constructs;
‱ Code generation: flow-graphs, register allocation, code-generation
algorithms;
‱ Introduction to code optimization techniques.
8-Jan-15 CS346 Lecture 1 2
Books
‱ Text Book
– Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman,
Compilers: Principles, Techniques, and Tools, 2nd Edition,
Prentice Hall, 2009
‱ Reference Books
– V. Raghavan, Principles of Compiler Design, McGrawHill, 2010
– C.N. Fischer, R.J. Le Blanc, Crafting a Compiler with C, Pearson
Education, 2009
– K. D. Cooper, L. Torczon, Engineering a Compiler, Morgan
Kaufmann Publishers, 2004
– Allen Holub, Compiler Design in C, Prentice-Hall software series,
1990
8-Jan-15 CS346 Lecture 1 3
Grades
‱ 2 Quiz s
– 20% of grade
‱ Mid-Semester
– 30% of grade
‱ End-Semester
– 50% of grade
‱ Attendance below 75% --- F Grade
‱ Random Attendance
8-Jan-15 CS346 Lecture 1 4
8-Jan-15 CS346 Lecture 1 6
Basic Blocks of Computing System
8-Jan-15 CS346 Lecture 1 7
Program Execution: Layered Architecture
High Level Language
Program
Assembly Language
Program
Compiler
Assembler +
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
lw $15, 0($2)
lw $16, 4($2)
sw $16, 0($2)
sw $15, 4($2)
Machine Language
Program
Control Signal
Specification
Assembler +
Linker + Loader
Machine Interpretation
sw $15, 4($2)
0000 1001 1100 0110 1010 1111 0101 1000
1010 1111 0101 1000 0000 1001 1100 0110
1100 0110 1010 1111 0101 1000 0000 1001
0101 1000 0000 1001 1100 0110 1010 1111
°
°
ALUOP[0:3] <= InstReg[9:11] & MASK
8-Jan-15 CS346 Lecture 1 8
Architecture of Computing System
Compiler
Operating
System
Application
Instruction Set
Architecture
Firmware
I/O systemInstr. Set Proc.
Digital Design
Circuit Design
Architecture
Datapath & Control
Layout
8-Jan-15 CS346 Lecture 1 9
Definitions
‱ What is a compiler?
– A program that accepts as input a program text in a certain language and
produces as output a program text in another language, while preserving the
meaning of that text (Grune et al, 2000).
– A program that reads a program written in one language (source language)
and translates it into an equivalent program in another language (target
language) (Aho et al)
– Report errors of source language which are detected during the
8-Jan-15 CS346 Lecture 1 10
– Report errors of source language which are detected during the
translation process
‱ What is an interpreter?
– A program that reads a source program and produces the results of executing
this source.
‱ We deal with compilers! Many of these issues arise with interpreters!
Compiler Vs. Interpreter
Compiler
Source Program
Interpreter
Source Program
Input
Output
Target Program
Target ProgramInput Output
Translator
Source Program
Intermediate
Program
Input
Virtual
Machine Output
A Hybrid Compiler
Examples
‱ C is typically compiled
‱ Lisp is typically interpreted
‱ Java is compiled to bytecodes, which are then interpreted
‱ source-to-source compiler, transcompiler, or transpiler :
– C++ to C
– High Performance Fortran (HPF) to Fortran (parallelising compiler)
8-Jan-15 12
– High Performance Fortran (HPF) to Fortran (parallelising compiler)
‱ Cross Compilers (wiki)
– A cross compiler is a compiler capable of
reading executable code for a platform other than the one on
which the compiler is running. For example, a compiler that runs
on a Windows 7 PC but generates code that runs
on Android Smartphone is a cross compiler.
CS346 Lecture 1
Qualities of a Good Compiler
What qualities would you want in a compiler?
– generates correct code (first and foremost!)
– generates fast code
– conforms to the specifications of the input language
– copes with essentially arbitrary input size, variables,
8-Jan-15 13
– copes with essentially arbitrary input size, variables,
etc.
– compilation time (linearly)proportional to size of source
– good diagnostics
– consistent optimisations
– works well with the debugger
CS346 Lecture 1
Principles of Compilation
The compiler must:
‱ preserve the meaning of the program being compiled.
‱ “improve” the source code in some way.
Other issues (depending on the setting):
8-Jan-15 14
Other issues (depending on the setting):
‱ Speed (of compiled code)
‱ Space (size of compiled code)
‱ Feedback (information provided to the user)
‱ Debugging (transformations obscure the relationship source code vs target)
‱ Compilation time efficiency (fast or slow compiler?)
CS346 Lecture 1
Applications
‱ Most common use: translate a high-level program to object code
– Program Translation: binary translation, hardware synthesis, 

‱ Optimizations for computer architectures:
– Improve program performance, take into account hardware parallelism, etc

‱ Interpreters: e.g., BASIC, Lisp etc.
8-Jan-15 15
‱ Software productivity tools
– Debugging aids: e.g., purify
‱ Text formatters, just-in-time compilation for Java, power
management, global distributed computing, 

Key: Ability to extract properties of a source program (analysis) and
transform it to construct a target program (synthesis)
CS346 Lecture 1
Lecture1 introduction compilers

Mais conteĂșdo relacionado

Mais procurados

System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
Manoj Patil
 

Mais procurados (20)

Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Type checking compiler construction Chapter #6
Type checking compiler construction Chapter #6Type checking compiler construction Chapter #6
Type checking compiler construction Chapter #6
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design Introduction
 
Chapter 5 Syntax Directed Translation
Chapter 5   Syntax Directed TranslationChapter 5   Syntax Directed Translation
Chapter 5 Syntax Directed Translation
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Syntax analysis
Syntax analysisSyntax analysis
Syntax analysis
 
Assemblers
AssemblersAssemblers
Assemblers
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Compiler1
Compiler1Compiler1
Compiler1
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Toy compiler
Toy compilerToy compiler
Toy compiler
 

Destaque

DFA Minimization
DFA MinimizationDFA Minimization
DFA Minimization
guest5873b2d
 

Destaque (20)

roshan.ppt
roshan.pptroshan.ppt
roshan.ppt
 
Lecture2 general structure of a compiler
Lecture2 general structure of a compilerLecture2 general structure of a compiler
Lecture2 general structure of a compiler
 
Lecture6 syntax analysis_2
Lecture6 syntax analysis_2Lecture6 syntax analysis_2
Lecture6 syntax analysis_2
 
ŰȘŰčŰ±Ù Ű„Ù„Ù‰-Ű§Ù„Ù‡Ù†ŰŻŰłŰ© Ű§Ù„Ù…ŰčÙ„ÙˆÙ…Ű§ŰȘÙŠŰ©
ŰȘŰčŰ±Ù Ű„Ù„Ù‰-Ű§Ù„Ù‡Ù†ŰŻŰłŰ© Ű§Ù„Ù…ŰčÙ„ÙˆÙ…Ű§ŰȘÙŠŰ©ŰȘŰčŰ±Ù Ű„Ù„Ù‰-Ű§Ù„Ù‡Ù†ŰŻŰłŰ© Ű§Ù„Ù…ŰčÙ„ÙˆÙ…Ű§ŰȘÙŠŰ©
ŰȘŰčŰ±Ù Ű„Ù„Ù‰-Ű§Ù„Ù‡Ù†ŰŻŰłŰ© Ű§Ù„Ù…ŰčÙ„ÙˆÙ…Ű§ŰȘÙŠŰ©
 
Lecture5 syntax analysis_1
Lecture5 syntax analysis_1Lecture5 syntax analysis_1
Lecture5 syntax analysis_1
 
ف 2 Ű§Ù„ŰŻŰ±Űł Ű§Ù„ŰŁÙˆÙ„ ÙˆŰ§Ù„Ű«Ű§Ù†Ù‰ ÙˆŰ§Ù„Ű«Ű§Ù„Ű«
ف 2 Ű§Ù„ŰŻŰ±Űł Ű§Ù„ŰŁÙˆÙ„ ÙˆŰ§Ù„Ű«Ű§Ù†Ù‰ ÙˆŰ§Ù„Ű«Ű§Ù„Ű«Ù 2 Ű§Ù„ŰŻŰ±Űł Ű§Ù„ŰŁÙˆÙ„ ÙˆŰ§Ù„Ű«Ű§Ù†Ù‰ ÙˆŰ§Ù„Ű«Ű§Ù„Ű«
ف 2 Ű§Ù„ŰŻŰ±Űł Ű§Ù„ŰŁÙˆÙ„ ÙˆŰ§Ù„Ű«Ű§Ù†Ù‰ ÙˆŰ§Ù„Ű«Ű§Ù„Ű«
 
Symbolic Automata = Automata + SMT solvers at ExCape14
Symbolic Automata = Automata + SMT solvers at ExCape14Symbolic Automata = Automata + SMT solvers at ExCape14
Symbolic Automata = Automata + SMT solvers at ExCape14
 
Lecture3 lexical analysis
Lecture3 lexical analysisLecture3 lexical analysis
Lecture3 lexical analysis
 
DFA minimization algorithms in map reduce
DFA minimization algorithms in map reduceDFA minimization algorithms in map reduce
DFA minimization algorithms in map reduce
 
DFA Minimization
DFA MinimizationDFA Minimization
DFA Minimization
 
Lecture4 lexical analysis2
Lecture4 lexical analysis2Lecture4 lexical analysis2
Lecture4 lexical analysis2
 
Isdn
IsdnIsdn
Isdn
 
Forouzan isdn
Forouzan isdnForouzan isdn
Forouzan isdn
 
optimization of DFA
optimization of DFAoptimization of DFA
optimization of DFA
 
Integrated service digital network
Integrated service digital networkIntegrated service digital network
Integrated service digital network
 
Basic ISDN
Basic ISDNBasic ISDN
Basic ISDN
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Isdn
IsdnIsdn
Isdn
 
Isdn networking
Isdn networkingIsdn networking
Isdn networking
 
ISDN Integrated Services Digital Network
ISDN Integrated Services Digital NetworkISDN Integrated Services Digital Network
ISDN Integrated Services Digital Network
 

Semelhante a Lecture1 introduction compilers

Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
Vasavi College of Engg
 

Semelhante a Lecture1 introduction compilers (20)

Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
 
Introduction to Compiler
Introduction to CompilerIntroduction to Compiler
Introduction to Compiler
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
Introduction_to_Programming.pptx
Introduction_to_Programming.pptxIntroduction_to_Programming.pptx
Introduction_to_Programming.pptx
 
Lecture1 compilers
Lecture1 compilersLecture1 compilers
Lecture1 compilers
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
introduction to computer vision and image processing
introduction to computer vision and image processingintroduction to computer vision and image processing
introduction to computer vision and image processing
 
Cpcs302 1
Cpcs302  1Cpcs302  1
Cpcs302 1
 
Compiler design
Compiler designCompiler design
Compiler design
 
Cd econtent link1
Cd econtent link1Cd econtent link1
Cd econtent link1
 
Chapter 4 computer language
Chapter 4 computer languageChapter 4 computer language
Chapter 4 computer language
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
Compiler an overview
Compiler  an overviewCompiler  an overview
Compiler an overview
 
X-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdfX-CS-8.0 Programming in C Language 2022-2023.pdf
X-CS-8.0 Programming in C Language 2022-2023.pdf
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
 
Bsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system softwareBsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system software
 
Bba i-introduction to computer-u-2- application and system software
Bba  i-introduction to computer-u-2- application and system softwareBba  i-introduction to computer-u-2- application and system software
Bba i-introduction to computer-u-2- application and system software
 
CD U1-5.pptx
CD U1-5.pptxCD U1-5.pptx
CD U1-5.pptx
 
Computer Programming In C.pptx
Computer Programming In C.pptxComputer Programming In C.pptx
Computer Programming In C.pptx
 
Bca i-fundamental of computer-u-2- application and system software
Bca  i-fundamental of  computer-u-2- application and system softwareBca  i-fundamental of  computer-u-2- application and system software
Bca i-fundamental of computer-u-2- application and system software
 

Mais de Mahesh Kumar Chelimilla (14)

Lecture11 syntax analysis_7
Lecture11 syntax analysis_7Lecture11 syntax analysis_7
Lecture11 syntax analysis_7
 
Lecture10 syntax analysis_6
Lecture10 syntax analysis_6Lecture10 syntax analysis_6
Lecture10 syntax analysis_6
 
Lecture9 syntax analysis_5
Lecture9 syntax analysis_5Lecture9 syntax analysis_5
Lecture9 syntax analysis_5
 
Lecture8 syntax analysis_4
Lecture8 syntax analysis_4Lecture8 syntax analysis_4
Lecture8 syntax analysis_4
 
Lecture7 syntax analysis_3
Lecture7 syntax analysis_3Lecture7 syntax analysis_3
Lecture7 syntax analysis_3
 
Transportlayer tanenbaum
Transportlayer tanenbaumTransportlayer tanenbaum
Transportlayer tanenbaum
 
Network layer tanenbaum
Network layer tanenbaumNetwork layer tanenbaum
Network layer tanenbaum
 
Forouzan x25
Forouzan x25Forouzan x25
Forouzan x25
 
Forouzan ppp
Forouzan pppForouzan ppp
Forouzan ppp
 
Forouzan frame relay
Forouzan frame relayForouzan frame relay
Forouzan frame relay
 
Forouzan data link_2
Forouzan data link_2Forouzan data link_2
Forouzan data link_2
 
Forouzan data link_1
Forouzan data link_1Forouzan data link_1
Forouzan data link_1
 
Forouzan atm
Forouzan atmForouzan atm
Forouzan atm
 
Datalinklayer tanenbaum
Datalinklayer tanenbaumDatalinklayer tanenbaum
Datalinklayer tanenbaum
 

Último

Top Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoor
dharasingh5698
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
sivaprakash250
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
KreezheaRecto
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
SUHANI PANDEY
 
Call Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night StandCall Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night Stand
amitlee9823
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Top Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor đŸ“± {7001035870} VIP Escorts chittoor
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night StandCall Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 đŸ„” Book Your One night Stand
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 

Lecture1 introduction compilers

  • 1. Compilers CS 346 3 – 0 – 0 – 6 Monday – Tuesday – Wednesday 9.00 --- 9.55 10.00 --- 10.55 11.00 --- 11.55 Arijit Sur Office: H-103 Department of Computer Science and Engineering Email: arijit@iitg.ernet.in Ph: 2361 Instructors: Dr. A. Sur and Dr. A. Sarkar
  • 2. Syllabus ‱ Overview of different phases of a compiler: front-end; back-end; ‱ Lexical analysis: specification of tokens, recognition of tokens, input buffering, automatic tools; ‱ Syntax analysis: context free grammars, top down and bottom up parsing techniques, construction of efficient parsers, syntax-directed translation, automatic tools; ‱ Semantic analysis: declaration processing, type checking, symbol tables,‱ Semantic analysis: declaration processing, type checking, symbol tables, error recovery; ‱ Intermediate code generation: run-time environments, translation of language constructs; ‱ Code generation: flow-graphs, register allocation, code-generation algorithms; ‱ Introduction to code optimization techniques. 8-Jan-15 CS346 Lecture 1 2
  • 3. Books ‱ Text Book – Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Compilers: Principles, Techniques, and Tools, 2nd Edition, Prentice Hall, 2009 ‱ Reference Books – V. Raghavan, Principles of Compiler Design, McGrawHill, 2010 – C.N. Fischer, R.J. Le Blanc, Crafting a Compiler with C, Pearson Education, 2009 – K. D. Cooper, L. Torczon, Engineering a Compiler, Morgan Kaufmann Publishers, 2004 – Allen Holub, Compiler Design in C, Prentice-Hall software series, 1990 8-Jan-15 CS346 Lecture 1 3
  • 4. Grades ‱ 2 Quiz s – 20% of grade ‱ Mid-Semester – 30% of grade ‱ End-Semester – 50% of grade ‱ Attendance below 75% --- F Grade ‱ Random Attendance 8-Jan-15 CS346 Lecture 1 4
  • 5.
  • 7. Basic Blocks of Computing System 8-Jan-15 CS346 Lecture 1 7
  • 8. Program Execution: Layered Architecture High Level Language Program Assembly Language Program Compiler Assembler + temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; lw $15, 0($2) lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) Machine Language Program Control Signal Specification Assembler + Linker + Loader Machine Interpretation sw $15, 4($2) 0000 1001 1100 0110 1010 1111 0101 1000 1010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111 ° ° ALUOP[0:3] <= InstReg[9:11] & MASK 8-Jan-15 CS346 Lecture 1 8
  • 9. Architecture of Computing System Compiler Operating System Application Instruction Set Architecture Firmware I/O systemInstr. Set Proc. Digital Design Circuit Design Architecture Datapath & Control Layout 8-Jan-15 CS346 Lecture 1 9
  • 10. Definitions ‱ What is a compiler? – A program that accepts as input a program text in a certain language and produces as output a program text in another language, while preserving the meaning of that text (Grune et al, 2000). – A program that reads a program written in one language (source language) and translates it into an equivalent program in another language (target language) (Aho et al) – Report errors of source language which are detected during the 8-Jan-15 CS346 Lecture 1 10 – Report errors of source language which are detected during the translation process ‱ What is an interpreter? – A program that reads a source program and produces the results of executing this source. ‱ We deal with compilers! Many of these issues arise with interpreters!
  • 11. Compiler Vs. Interpreter Compiler Source Program Interpreter Source Program Input Output Target Program Target ProgramInput Output Translator Source Program Intermediate Program Input Virtual Machine Output A Hybrid Compiler
  • 12. Examples ‱ C is typically compiled ‱ Lisp is typically interpreted ‱ Java is compiled to bytecodes, which are then interpreted ‱ source-to-source compiler, transcompiler, or transpiler : – C++ to C – High Performance Fortran (HPF) to Fortran (parallelising compiler) 8-Jan-15 12 – High Performance Fortran (HPF) to Fortran (parallelising compiler) ‱ Cross Compilers (wiki) – A cross compiler is a compiler capable of reading executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a Windows 7 PC but generates code that runs on Android Smartphone is a cross compiler. CS346 Lecture 1
  • 13. Qualities of a Good Compiler What qualities would you want in a compiler? – generates correct code (first and foremost!) – generates fast code – conforms to the specifications of the input language – copes with essentially arbitrary input size, variables, 8-Jan-15 13 – copes with essentially arbitrary input size, variables, etc. – compilation time (linearly)proportional to size of source – good diagnostics – consistent optimisations – works well with the debugger CS346 Lecture 1
  • 14. Principles of Compilation The compiler must: ‱ preserve the meaning of the program being compiled. ‱ “improve” the source code in some way. Other issues (depending on the setting): 8-Jan-15 14 Other issues (depending on the setting): ‱ Speed (of compiled code) ‱ Space (size of compiled code) ‱ Feedback (information provided to the user) ‱ Debugging (transformations obscure the relationship source code vs target) ‱ Compilation time efficiency (fast or slow compiler?) CS346 Lecture 1
  • 15. Applications ‱ Most common use: translate a high-level program to object code – Program Translation: binary translation, hardware synthesis, 
 ‱ Optimizations for computer architectures: – Improve program performance, take into account hardware parallelism, etc
 ‱ Interpreters: e.g., BASIC, Lisp etc. 8-Jan-15 15 ‱ Software productivity tools – Debugging aids: e.g., purify ‱ Text formatters, just-in-time compilation for Java, power management, global distributed computing, 
 Key: Ability to extract properties of a source program (analysis) and transform it to construct a target program (synthesis) CS346 Lecture 1