U1-2compiler -phases of the compiler.ppt - Compilers Analysis of the Source Program Phases of a Compiler Slide 1 Compiler phases Lexical analysis Syntax

U1-2compiler -phases of the compiler.ppt - Compilers...

This preview shows page 1 - 15 out of 28 pages.

Slide 1 Compilers - Analysis of the Source Program - Phases of a Compiler
Image of page 1
Slide 2 02/15/18 Compiler phases Lexical analysis Syntax analysis Semantic analysis Intermediate (machine-independent) code generation Intermediate code optimization Target (machine-dependent) code generation Target code optimization
Image of page 2
Slide 3 What is a compiler? A program that reads a program written in one language (source language) and translates it into an equivalent program in another language (target language).
Image of page 3
Compiler phases
Image of page 4
Slide 5
Image of page 5
Slide 6
Image of page 6
Slide 7 A simple statement through the phases of a compiler
Image of page 7
Slide 8
Image of page 8
02/15/18 Compiler Front- and Back-end Semantic Analysis  and Intermediate  Code Generation Scanner (lexical analysis) Parser (syntax analysis) Machine- Independent Code  Improvement Target Code  Generation Machine-Specific  Code Improvement Source program (character stream) Tokens Parse tree Abstract syntax tree or other intermediate form Modified intermediate form  object code Modified  object code Abstract syntax tree or other intermediate form Front end analysis Back end synthesis
Image of page 9
Image of page 10
Image of page 11
02/15/18 Scanner: Lexical Analysis Lexical analysis breaks up a program into tokens Grouping characters into non-separatable units (tokens) Changing a stream to characters to a stream of tokens program gcd (input, output); var i, j : integer ; begin read (i, j); while i <> j do if i > j then i := i - j else j := j - i; writeln (i) end . program gcd ( input , output ) ; var i , j : integer ; begin read ( i , j ) ; while i <> j do if i > j then i := i - j else j := i - i ; writeln ( i ) end .
Image of page 12
Slide 13 Symbol table
Image of page 13
Slide 14 02/15/18 Parser: Syntax Analysis
Image of page 14
Image of page 15

You've reached the end of your free preview.

Want to read all 28 pages?

  • Winter '17
  • sathya raja shekaran

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors