1 / 18

Lecture # 1

Lecture # 1. Compiler Design CSE344. Introduction to Compiler Design. Instructor: Asma Sanam Larik Text Book: Compilers: Principles, Techniques and Tools by Aho, Sethi and Ullman (2 nd Edition) Course Website: http://cse344compilerdesign.wikispaces.com/. Course Syllabus: An overview

ledell
Download Presentation

Lecture # 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture # 1 Compiler Design CSE344

  2. Introduction to Compiler Design • Instructor: Asma Sanam Larik • Text Book: Compilers: Principles, Techniques and Tools by Aho, Sethi and Ullman (2nd Edition) • Course Website: http://cse344compilerdesign.wikispaces.com/

  3. Course Syllabus: An overview • Grading Policy Midterm Exams 30% Assignments 10% Quizzes 5% (best 5) Project 15% (3 phases) Final 40%

  4. Class Taking Techniques • I will use projected material extensively • I welcome questions • PowerPoint materials available on web page • Read the book- Not all material will be covered in class • The midterms will cover both lecture and reading • I take surprise quiz • Submit the assignments within due date

  5. What is a Compiler? • A compiler is a program that reads a program written in one language called the source language into an equivalent program in another language called the target language. The target program is then provided the input to produce output. C, Java, Pascal all are compiled

  6. What is an Interpreter? • An interpreter requires no pre-computation it directly takes the source program and runs the input on it producing the desired output. Ada is interpreted.

  7. Positive/Negative of Interpretation • Positive: • No pre-computation on the program text • Short startup time faster for smaller programs • Negative: • Program parts are repeatedly analyzed during execution • less efficient access to program variables • Slower execution speed

  8. Essence of Compilation • Compile Time and Run time are two different phases • Static Information available at Compile Time including • Declared variables • Size and dimension of arrays incase of C, Pascal • Space for declared variable • Addresses for declared variable • Dynamic Information would be available at runtime including • value of expressions • value of pointer • virtual function information etc

  9. Trade-off: Compilation Time vs Runtime • Pre-processing of source program provides for efficient access to the values of program variable at runtime however compilation takes time • When program execution is sped up compilation pays off in long run

  10. Why study Compilation? • Compilers are important • Responsible for many aspects of system performance • Attaining performance has become more difficult over time • Compilers are interesting • Compilers include many applications of theory to practice • Writing a compiler exposes algorithmic & engineering issues • Compilers are everywhere • Many practical applications have embedded languages Commands, macros, formatting tags

  11. Why study Compilation? • Computer Science is the art of creating virtual objects and making them useful. • We invent abstractions and uses for them • We invent ways to make them efficient • Programming is the way we realize these inventions • Well written compilers make abstraction affordable

  12. Example

  13. Challenges of Compiler Construction Compiler construction poses challenging and interesting problems: • Compilers must process large inputs, perform complex algorithms, but also run quickly • Compilers have primary responsibility for run-time performance • Compilers are responsible for making it acceptable to use the full power of the programming language • Computer architects perpetually create new challenges for the compiler by building more complex machine • Compilers must hide that complexity from the programmer A successful compiler requires mastery of the many complex interactions between its constituent parts

  14. Compiler and other areas • Compiler construction involves ideas from many different parts of computer science • Artificial intelligence: Greedy algorithms, Heuristic search techniques • Algorithms: Graph algorithms, Dynamic programming • Theory of Automata: DFAs & PDAs, pattern matching, regular expressions • Architecture: Pipelining and Instruction set use

  15. Lets start the course…… Highly Motivated

  16. Analysis-Synthesis Model of Compilation • There are two parts to compilation: • Analysis determines the operations implied by the source program which are recorded in a tree structure • Synthesis takes the tree structure and translates the operations therein into the target program

  17. Phases of Compiler • Lexical Analysis • Syntax Analysis • Semantic Analysis • Intermediate code generation • Code Optimization • Code Generator

  18. Phases of Compiler

More Related