1 / 8

Compilers

Compilers. B V Sai Aravind (11CS10008). Outlines. Structure of a Compiler Phases of a Compiler Lexical Analysis Syntax Analysis Semantic Analysis. Structure of a Compiler. Any compiler must perform two major tasks. Analysis of the source program.

lisbet
Télécharger la présentation

Compilers

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. Compilers B V Sai Aravind (11CS10008)

  2. Outlines • Structure of a Compiler • Phases of a Compiler • Lexical Analysis • Syntax Analysis • Semantic Analysis

  3. Structure of a Compiler • Any compiler must perform two major tasks. • Analysis of the source program. • Synthesis of a machine-language program. Compiler Analysis Synthesis

  4. Phases of a Compiler

  5. Phases of a Compiler Symbol Table Manager Intermediate Code Generator Source Program Lexical Analyzer Target Program Code Generator Semantic Analyzer Syntax Analyzer Code Optimizer Error Handler

  6. Lexical Analysis • Characters are grouped into tokens. Example: position = initial + rate * 60 • Position <Identifier, 1> • Operator = <=> • initial <Identifier, 2> • Operator + <+> • Rate <Identifier, 3> • Operator * <*> • 60 <number, 60>

  7. Syntax Analysis • Character groups recorded in symbol table. • The tokens grouped into grammatical phrases. • A parser tree constructed specified by the grammar of the source language.

  8. Semantic Analyzer • Type Checking • Consider the array element A[i] • Checks if i is an integer. • Type Casting • int *float; • Casts the int to float.

More Related