











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












CSC373-Compiler Construction Week-3 Lecture- Semester-#5 Fall 2019 Prepared by: Eisha Tir Razia Lahore Garrison University
(^) Symbol Table (^) How to construct Symbol Table? Lahore Garrison University
(^) Understanding related to (^) Two-Pass Compiler Lahore Garrison University
(^) The discussion of phases deals with the logical organization of a compiler. In an implementation, activities from several phases may be grouped together into a pass that reads an input file and writes an output file. (^) For example, the front-end phases of lexical analysis, syntax analysis, semantic analysis, and intermediate code generation might be grouped together into one pass. Code optimization might be an optional pass. Then there could be a back-end pass consisting of code generation for a particular target machine. Lahore Garrison University
(^) Use an intermediate representation (IR) (^) Front end maps legal source code into IR
(^) Front end is O(n) or O(n log n) (^) Back end is NP-Complete (NPC)
(^) Recognizes legal (& illegal) programs (^) Report errors in a useful way (^) Produce IR & preliminary storage map
(^) Maps character stream into words – basic unit of syntax (^) Produces pairs – (^) a word and (^) its part of speech
(^) we call the pair “<token type, word>” a “token” (^) typical tokens: number , identifier , +, -, new , while , if
(^) Recognizes context-free syntax and reports errors (^) Guides context-sensitive (“semantic”) analysis (^) Builds IR for source program
(^) These lecture notes were taken from following source: (^) Compilers: Principles, Techniques, and Tools By Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman, Contributor Jeffrey D. Ullman, Addison- Wesley Pub. Co., 2nd edition, 2006 Lahore Garrison University