×
In real life, there is no such thing as second place. Either you are a winner, or you’re not.
--Your friends at LectureNotes
Close

Solution to Previous Year Exam Questions for Compiler Design - CD of HITECH by VijayaKumar Thangavel

  • Compiler Design - CD
  • 2013
  • PYQ Solution
  • ANNA UNIVERISTY - HITECH
  • Computer Science Engineering
  • B.Tech
  • 4999 Views
  • 59 Offline Downloads
  • Uploaded 11 months ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

Dr.N.G.P. Institute of Technology,Coimbatore CS6660/Compiler Design Syllabus CS6660 COMPILER DESIGN LTPC 3 0 0 3 OBJECTIVES: The student should be made to:  Learn the design principles of a Compiler.  Learn the various parsing techniques and different levels of translation  Learn how to optimize and effectively generate machine codes UNIT I INTRODUCTION TO COMPILERS 5 Translators-Compilation and Interpretation-Language processors -The Phases of CompilerErrors Encountered in Different Phases-The Grouping of Phases-Compiler Construction Tools Programming Language basics. UNIT II LEXICAL ANALYSIS 9 Need and Role of Lexical Analyzer-Lexical Errors-Expressing Tokens by Regular ExpressionsConverting Regular Expression to DFA- Minimization of DFA-Language for Specifying Lexical Analyzers-LEX-Design of Lexical Analyzer for a sample Language. UNIT III SYNTAX ANALYSIS 10 Need and Role of the Parser-Context Free Grammars - Top Down Parsing -General StrategiesRecursive Descent Parser Predictive Parser-LL(1) Parser-Shift Reduce Parser-LR Parser-LR (0)Item-Construction of SLR Parsing Table -Introduction to LALR Parser - Error Handling and Recovery in Syntax Analyzer-YACC-Design of a syntax Analyzer for a Sample Language . UNIT IV SYNTAX DIRECTED TRANSLATION & RUN TIME ENVIRONMENT 12 Syntax directed Definitions-Construction of Syntax Tree-Bottom-up Evaluation of S-Attribute Definitions- Design of predictive translator - Type Systems-Specification of a simple type checker-Equivalence of Type Expressions-Type Conversions. RUN-TIME ENVIRONMENT: Source Language Issues-Storage Organization-Storage Allocation-Parameter Passing-Symbol Tables-Dynamic Storage Allocation-Storage Allocation in FORTAN. UNIT V CODE OPTIMIZATION AND CODE GENERATION 9 Principal Sources of Optimization-DAG- Optimization of Basic Blocks-Global Data Flow Analysis-Efficient Data Flow Algorithms-Issues in Design of a Code Generator - A Simple Code Generator Algorithm. TOTAL: 45 PERIODS OUTCOMES: At the end of the course, the student should be able to:  Design and implement a prototype compiler.  Apply the various optimization techniques.  Use the different compiler construction tools. Question Bank- Two Marks With Answer Prepared by T.VijayaKumar,AP/ IT

Text from page-2

Dr.N.G.P. Institute of Technology,Coimbatore CS6660/Compiler Design TEXTBOOK: 1. Alfred V Aho, Monica S. Lam, Ravi Sethi and Jeffrey D Ullman, “Compilers – Principles, Techniques and Tools”, 2nd Edition, Pearson Education, 2007. REFERENCES: 1. Randy Allen, Ken Kennedy, “Optimizing Compilers for Modern Architectures: A Dependence-based Approach”, Morgan Kaufmann Publishers, 2002. 2. Steven S. Muchnick, “Advanced Compiler Design and Implementation, “Morgan Kaufmann Publishers - Elsevier Science, India, Indian Reprint 2003. 3. Keith D Cooper and Linda Torczon, “Engineering a Compiler”, Morgan Kaufmann Publishers Elsevier Science, 2004. 4. Charles N. Fischer, Richard. J. LeBlanc, “Crafting a Compiler with C”, Pearson Education, 2008. Question Bank- Two Marks With Answer Prepared by T.VijayaKumar,AP/ IT

Text from page-3

Dr.N.G.P. Institute of Technology,Coimbatore CS6660/Compiler Design UNIT I INTRODUCTION TO COMPILERS Translators-Compilation and Interpretation-Language processors -The Phases of CompilerErrors Encountered in Different Phases-The Grouping of Phases-Compiler Construction Tools Programming Language basics. 1. Define compiler. (Nov/Dec 2011, 2009) A compiler is a program that reads a program written in one language (source language) and translates it into an equivalent program in another language(target language) and the compiler reports to its user the presence of errors in the source program. Source Program Target Program COMPILER Error Messages 2. What are the classifications of compiler? The classifications of compiler are:     Single pass compiler Multi pass compiler Load-and-go compiler Debugging or optimizing compiler 3. What are the two parts of a compilation? (or) State the two main parts of compilation and its function. (or) Recall the basic two parts of a compilation process. (May/June 2016,April/May 2017 & 2018,Nov/Dec 2018) The two parts of a compilation are Analysis and Synthesis. The analysis part breaks up the source program into constituent pieces and creates an intermediate representation on the source program. It also termed as front end of compiler The synthesis part constructs the desired target program from the intermediate representation. It is also termed as back end of compiler. 4. What are the phases of compiler? (Dec 2008) The phases of compiler are:  Lexical analyzer  Syntax analyzer  Semantic analyzer  Intermediate code generation  Code generation  Code optimization  Symbol table manager. Question Bank- Two Marks With Answer Prepared by T.VijayaKumar,AP/ IT

Text from page-4

Dr.N.G.P. Institute of Technology,Coimbatore CS6660/Compiler Design 5. Illustrate diagrammatically how a language is processed. (May/June 2016) 6. Define preprocessor & what are the functions of preprocessor? Preprocessor produce input to the compilers (i.e.) the program will be divided in to the modules. They may perform the following functions.     Macro processing File inclusion Rational preprocessor Language extension 7. Name few tools that could be used for the various phases of the compiler.(Nov 2012) Tools that could be used for the various phases of the compiler:  Parse generator  Scanner generators  Syntax-directed translation engines  Automatic code generator  Data flow engines 8. What are the tools available in analysis phase? The tools available in analysis phase are:     Structure editors Pretty printer Static checkers Interpreters. Question Bank- Two Marks With Answer Prepared by T.VijayaKumar,AP/ IT

Lecture Notes