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
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