compiler design - introduction to compiler

Download Compiler Design - Introduction to Compiler

If you can't read please download the document

Post on 14-Jan-2017




9 download

Embed Size (px)


  • **

  • Iffat Anjum (IFF)

    Formal Email:

    Submission Email: iffat.submission@gmail.comPhone: 01814928290

    Google Group:CompilerDesignBRACU!forum/compilerdesignbracu


  • Theory Class Schedule: Section 01: (UB30503)Sunday, Monday11.00 am - 12.20 pmSection 02: (UB30501)Sunday, Monday08.00 am - 9.20 amLab Class Schedule:Section 01: (UB40203)NUM, MAZ Monday, 08:00 am - 10:50 am Section 02: (UB40203) MAA, MKR Thursday, 08:00 am-10:50 am **

  • 35% - Final Examination25% - LAB performance20% - MID Examination8% - Assignment & Surprise Quizzes7% - Declared Quizzes5% - Attendance

    No students will be allowed to sit for final examination if he/she has less than 70% attendance in LAB Class and less than 75% attendance in Theory Class


  • There will be surprise quizzes, given at the start of a lecture, during any lecture.

    NO LATE or MAKEUP SURPRISE QUIZZES, under any circumstances whatsoever.

    Surprise quizzes are completely individual efforts.

    Your best strategy is to play it safe attend every lecture.

    Surprise Quizzes**


  • Assignments need to be hand-written. I will not accept typed up solutions.

    Assignments are completely individual efforts. If two written solutions are the same or similar, both will be penalized (100% penalty for the entire assignment). If a written solution is similar or same as an online or other solution resource, you will be penalized (100% penalty for the entire assignment).



  • If you follow these 4 simple rules during the class, you'll make sure that you do well in the course:

    Attend every Theory and LAB classes.

    Read the course material (textbook sections assigned + slides).

    Submit everything (Assignments, Quizzes, Exams) on time - don't be late.

    Don't cheat. Playing it safe in CSE-420**


  • Two Quizzes

    Several Surprise Quizzes

    If you fail to attend any exam you will get 0 (zero) on that exam.

    No makeup exams unless with documented medical emergency.

    Quizzes and Exams**


  • Strong programming background in C, C++ or Java

    Some background on Automata Theory (NFA, DFA, CFG) is recommended not mandatory

    Assembly Language Programming and Machine Architecture

    Pre-requisite Knowledge**


  • Aho, Lam, Sethi, Ullman:Compilers: Principles, Techniques, and Tools (2nd Edition)

    Recommended Books**

  • Compiler BasicsLexical AnalysisSyntax AnalysisSemantic AnalysisRuntime environmentsCode GenerationCode Optimization

    The Course covers**


  • Programming problems are easier to solve in high-level languagesLanguages closer to the level of the problem domain, e.g.,SmallTalk: OO programmingJavaScript: Web pages

    Solutions are usually more efficient (faster, smaller) when written in machine languageLanguage that reflects to the cycle-by-cycle working of a processor

    Compilers are the bridges:Tools to translate programs written in high-level languages to efficient executable code

    What is a compiler?**

  • Interpreters:


    Introduction To Compilers**

  • 1954 IBM develops the 704 Successor to the 701



    Introduction To Compilers**

  • The first compiler Huge impact on computer science

    Led to an enormous body of theoretical work

    Modern compilers preserve the outline of FORTRAN I

    Introduction To Compilers**

  • Lexical Analysis Parsing Semantic Analysis Optimization Code Generation

    Introduction To Compilers**

  • First step: recognize words. Smallest unit above letters

    This is a sentence

    Introduction To Compilers**

  • ist his ase nte nce

    Introduction To Compilers**

  • Lexical analysis divides program text into words or tokens

    if x == y then z = 1; else z = 2;

    Introduction To Compilers**

  • Lexical analysis divides program text into words or tokens

    if x == y then z = 1; else z = 2;

    Introduction To Compilers**

  • Second Step: Once words are understood, the next step is to understand sentence structure

    Parsing = Diagramming Sentences The diagram is a tree

    Introduction To Compilers**

  • This line is a longer sentence

    Introduction To Compilers**

  • if x == y then z = 1; else z = 2;

    Introduction To Compilers**

  • Third Step:

    Once sentence structure is understood, we can try to understand meaning This is hard! Compilers perform limited semantic analysis to catch inconsistencies

    Introduction To Compilers**

  • Programming languages define strict rules to avoid such ambiguities

    Introduction To Compilers{ int Jack = 3; { int Jack = 4; cout

  • Compilers perform many semantic checks besides variable bindings Example: Jack left her homework at home.

    A type mismatch between her and Jack; we know they are different people

    Introduction To Compilers**

  • Optimization has no strong counterpart in English But a little bit like editing

    X = Y * 0 is the same as X = 0

    Automatically modify programs so that they Run faster Use less memory

    Introduction To Compilers**

  • Produces assembly code (usually)

    A translation into another language Analogous to human translation

    Introduction To Compilers**

  • Question? **








View more >