DEPARTMENT OF INFORMATION TECHNOLOGY / COMPUTER SCIENCE AND ENGINEERING UNIT -1-INTRODUCTION TO COMPILERS 2 MARK QUESTIONS

Similar documents
VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Subject Name: CS2352 Principles of Compiler Design Year/Sem : III/VI

Question Bank. 10CS63:Compiler Design

Gujarat Technological University Sankalchand Patel College of Engineering, Visnagar B.E. Semester VII (CE) July-Nov Compiler Design (170701)

GUJARAT TECHNOLOGICAL UNIVERSITY

2068 (I) Attempt all questions.

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

QUESTIONS RELATED TO UNIT I, II And III

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING ACADEMIC YEAR / EVEN SEMESTER

INSTITUTE OF AERONAUTICAL ENGINEERING

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8]

Section A. A grammar that produces more than one parse tree for some sentences is said to be ambiguous.

VETRI VINAYAHA COLLEGE OF ENGINEERING AND TECHNOLOGY

SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA

LALR Parsing. What Yacc and most compilers employ.

Roll No. :... Invigilator's Signature :. CS/B.Tech(CSE)/SEM-7/CS-701/ LANGUAGE PROCESSOR. Time Allotted : 3 Hours Full Marks : 70

VIVA QUESTIONS WITH ANSWERS

The analysis part breaks up the source program into constituent pieces and creates an intermediate representation of the source program.

Compiler Design Aug 1996

1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail.

LECTURE NOTES ON COMPILER DESIGN P a g e 2

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

CS6660-COMPILER DESIGN UNIT I INTRODUCTION TO COMPILERS PART A

PSD3A Principles of Compiler Design Unit : I-V. PSD3A- Principles of Compiler Design

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY

QUESTION BANK CHAPTER 1 : OVERVIEW OF SYSTEM SOFTWARE. CHAPTER 2: Overview of Language Processors. CHAPTER 3: Assemblers

Syntax Analysis Part I

PRINCIPLES OF COMPILER DESIGN

PART 3 - SYNTAX ANALYSIS. F. Wotawa TU Graz) Compiler Construction Summer term / 309

General Overview of Compiler

Chapter 4. Lexical and Syntax Analysis. Topics. Compilation. Language Implementation. Issues in Lexical and Syntax Analysis.

COMPILER DESIGN. For COMPUTER SCIENCE


Talen en Compilers. Johan Jeuring , period 2. January 17, Department of Information and Computing Sciences Utrecht University

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN

CS143 Handout 20 Summer 2011 July 15 th, 2011 CS143 Practice Midterm and Solution

CS606- compiler instruction Solved MCQS From Midterm Papers

UNIT III & IV. Bottom up parsing

UNIT 1-UMAL DIAGRAMS. Q.No. Question Competence Level. 1 What is Object Oriented analysis & Design? Remembering BTL1

3. Syntax Analysis. Andrea Polini. Formal Languages and Compilers Master in Computer Science University of Camerino

INSTITUTE OF AERONAUTICAL ENGINEERING (AUTONOMOUS)

Let us construct the LR(1) items for the grammar given below to construct the LALR parsing table.

Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars

UNIT III. The following section deals with the compilation procedure of any program.

Context-free grammars

4. Lexical and Syntax Analysis

CS308 Compiler Principles Syntax Analyzer Li Jiang

1. The output of lexical analyser is a) A set of RE b) Syntax Tree c) Set of Tokens d) String Character

UNIT-III BOTTOM-UP PARSING

Compiler Construction: Parsing

4. Lexical and Syntax Analysis

CS 2210 Sample Midterm. 1. Determine if each of the following claims is true (T) or false (F).

CSE 401 Compilers. LR Parsing Hal Perkins Autumn /10/ Hal Perkins & UW CSE D-1

CSE P 501 Compilers. LR Parsing Hal Perkins Spring UW CSE P 501 Spring 2018 D-1

CS 4120 Introduction to Compilers

4. An interpreter is a program that

Formal Languages and Compilers Lecture VII Part 3: Syntactic A

Parsing Wrapup. Roadmap (Where are we?) Last lecture Shift-reduce parser LR(1) parsing. This lecture LR(1) parsing

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY

Chapter 4. Lexical and Syntax Analysis

MODULE 14 SLR PARSER LR(0) ITEMS


Concepts Introduced in Chapter 3. Lexical Analysis. Lexical Analysis Terms. Attributes for Tokens

VALLIAMMAI ENGINEERING COLLEGE

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

JNTUWORLD. Code No: R

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING COURSE PLAN

Final Term Papers 2013

CMSC 330: Organization of Programming Languages

CS5363 Final Review. cs5363 1

Downloaded from Page 1. LR Parsing

CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters

Chapter 3: Describing Syntax and Semantics. Introduction Formal methods of describing syntax (BNF)

EDAN65: Compilers, Lecture 06 A LR parsing. Görel Hedin Revised:

CST-402(T): Language Processors

Recursive Descent Parsers

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages

LR Parsing Techniques

University of Technology Department of Computer Sciences. Final Examination st Term. Subject:Compilers Design

Compiler Construction

10/5/17. Lexical and Syntactic Analysis. Lexical and Syntax Analysis. Tokenizing Source. Scanner. Reasons to Separate Lexical and Syntax Analysis

Introduction to Syntax Analysis. The Second Phase of Front-End

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

R13 SET Discuss how producer-consumer problem and Dining philosopher s problem are solved using concurrency in ADA.

Faculty of Electrical Engineering, Mathematics, and Computer Science Delft University of Technology

Introduction. Introduction. Introduction. Lexical Analysis. Lexical Analysis 4/2/2019. Chapter 4. Lexical and Syntax Analysis.

Life Cycle of Source Program - Compiler Design

Final Exam Review Questions

Lexical Analysis. Dragon Book Chapter 3 Formal Languages Regular Expressions Finite Automata Theory Lexical Analysis using Automata

CMSC 330: Organization of Programming Languages. Context Free Grammars

Parsing. Handle, viable prefix, items, closures, goto s LR(k): SLR(1), LR(1), LALR(1)

COLLEGE OF ENGINEERING, NASHIK. LANGUAGE TRANSLATOR

EXAM. CS331 Compiler Design Spring Please read all instructions, including these, carefully

BSCS Fall Mid Term Examination December 2012

Syntax Analysis: Context-free Grammars, Pushdown Automata and Parsing Part - 4. Y.N. Srikant

Principles of Programming Languages [PLP-2015] Detailed Syllabus

Transcription:

BHARATHIDASAN ENGINEERING COLLEGE DEPARTMENT OF INFORMATION TECHNOLOGY / COMPUTER SCIENCE AND ENGINEERING Year & Semester : III & VI Degree & Branch : B.E (CSE) /B.Tech (Information Technology) Subject Code : CS6660 Staff in charge : S.Tamil Vanan UNIT -1-INTRODUCTION TO COMPILERS 2 MARK QUESTIONS 1. Define compiler 2. Name few cousins of compiler May 2012 3. Point out any two reasons as to why phases of compiler should be grouped.(or) How will you group the phases of the compiler? JUNE 2014 4. Why is buffering used in lexical analysis? What are the commonly use buffering methods. JUNE 2014 5. Give some compiler construction tools Nov 2012 6. Differentiate between compiler and interpreter. May 2011 7. Apply the parse tree structure for the expression Position: =initial + rate *60. 8. Write a regular definition to represent date in the following format Jan- 5 th 2014. MAY 2015 9. Describe the error recovery schemes in the lexical phase of a compiler MAY 2015 10. Tell the main two parts of compilation? Describe them performances? Nov 2008 11. Describe the need of separating the analysis phase into lexical phase and parsing? 12. Summarize function of preprocessor? 13. Show the examples of some software tools that manipulate source program? Nov 2012 14. Define Hybrid compiler.and linker 15. Analyze the Errors in phases of the compiler 16. Illustrate the approaches use to recover the errors in lexical analysis phase May 2012 17. Explain about convert grouping of phases into passes JUNE 2014 18. Summarize the different error recovery techniques in syntax phase? May 2010 19. An arithmetic expression with unbalanced parenthesis is lexical or syntax error. Generalize your answer 20. Compose the advantages of language processing system in which the compiler produces assembly language rather than machine language? 1 Explain the phases of compiler? And how the following statement will be translated into every phase. Position: = initial + rate * 60. May 2016, Nov 2008 2 (i).discuss in detail about the role of Lexical and syntax analyzer with the possible error recovery actions. (ii).discuss in detail about role of lexical analysis? 3 (i).tell the various phases of the compiler and examine with programs segment (ii).discuss in detail about symbol table. May 2013

4 Describe the following expressions after each phases a: = b*c-d how various phases could be combined as pass in a compiler JUN 2014 5 (i).explain in detail about the compiler construction tools. (ii).explain in detail about the language processing system. May 2013 6 (i).describe the errors encountered in different phases of compiler. (ii).explain the functions of Preprocessor. 7 Define compiler? State various phases of complier and describe in detail 8 (i).how to solve the source program to target machine code by using language processing system. (ii).write in detail about the cousins of the compiler. JUN 2014 9 Generalize the important terminologies used in programming language basics 10 (i). Analyze the given expressions 4:*+=cba with different phases of the compiler (ii). Classify the concepts of compiler and Interpreter. May 2009 UNIT -2-LEXICAL ANALYSIS 2 MARK QUESTIONS 1 Define tokens, patterns and lexemes. JUNE 2014 2 Classify approach would you use to recover the errors in lexical analysis phase? May 2012 3 Apply the regular expression for identifier and white space? 4 Point out why is buffering used in lexical analysis? What are the commonly used buffering methods? Nov 2012 5 Define transition diagram for an identifier. Nov 2011 6 Compare syntax tree and parse tree. 7 Explain the issues in a lexical analyzer. 8 Define buffer pair? 9 Differentiate the features of DFA and NFA. JUNE 2014 10 Define Regular expression. MAY 2015 11 Explain a lexical analyzer with lex? 12 Describe the concepts of sentinel? 13 List out the Goals of Error Handler? May 2012 14 Generalizes the advantage of having sentinels at the end of each buffer halves in buffer pairs? 15 Explain four software tools that generate parser. 16 Discuss the Algebraic properties of Regular Expression. May 2008 17 Formulate the regular expressions are used though the lexical constructs of any programming language can be described using context free grammar? Nov 2009 18 Apply other way would you plan to minimize the DFA? 19 Express is the main idea of NFA? And discuss with examples (a/b)* 20 Define lex. Discuss the three parts of a lex program? 1 Convert the following NFA into DFA. Describe the sequence of moves made by each in processing the input string ababba. 2 (i).discuss in detail about the role of Lexical analyzer with the possible error recovery actions. (ii).what are the issues in lexical analysis? May 2012 3 (i).describe the Input buffering techniques in detail. (ii).elaborate in detail the recognition of tokens. May 2012

4 (i).solve the following regular expression into minimized DFA. (a/b)*baa (ii).comparison between NFA and DFA. May 2016 5 (i).define Lex and Lex specifications? How lexical analyzer is constructed using lex? (ii).write a lex program that recognizer the tokens. 6 Solve the given regular expression (a/b)* abb (a/b)* into NFA using Thompson construction and then to minimized DFA. May 2016 7 Write an algorithm for constructing a DFA from a regular expression. Discuss with an example. Nov 2009 8 (i).explain an algorithm for Lex that recognizes the tokens. (ii).elaborate specification of tokens. 9 Suppose we were to revise the definition of a DFA to allow zero or one transition out of each state on each input symbol. Some regular expressions would then have smaller DFA s than they do under the standard definition of a DFA. Give and generalize an example of one such regular expression. May 2012 10 How to converting a Regular Expression directly to a DFA. Explain with one example. May 2016 UNIT -3-SYNTAX ANALYSIS 2 MARK QUESTIONS 1 Write the rule to eliminate left recursion in a grammar. Prepare and eliminate the left recursion for the grammar S Aa b A Ac Sd ε May 2015 2 Define handle pruning. May 2011 3 Define Phrase level error recovery? Nov 2010 4 Describe the concepts of Predictive parsing and shift reduce parsing? 5 Differentiate Top down parsing and Bottom Up parsing? 6 Define Recursive Descent Parsing? 7 List out the properties of parse tree? 8 Compare and contrast top down parsing with bottom up parsing techniques. May 2011 9 Solve the following grammar is ambiguous: S asbs / bsas / Nov2013 10 Define kernel and non-kernel items (BTL-1) May 2016 11 Difference between ambiguous and unambiguous grammar. 12 Define parser. Explain the advantages and disadvantages of LR parsing? May 2016 13 Solve FIRST and FOLLOW by use the LL(1) grammar? Nov 2009 14 Evaluate the conflicts encountered while parsing? 15 Explain the categories of shift reduce parsing. May 2012 16 How to create an input and output translator with YACC. May 2015 17 Describe the Error recovery scheme in yacc. May 2016 18 What is the main idea of Left factoring? Give an example. 19 Discuss the topic on closure operation. 20 Examine what approach would you use in Panic mode error recovery? 1 Consider the following grammar S AS b A SA a. construct the SLR parse table for the grammar. Show the actions of the parser for the input string abab. May 2016

2 (i). What is an ambiguous and un ambiguous grammar? Create the following grammar is ambiguous or not. E E+E E*E (E) id. (ii). Prepare the following grammar is LL(1) but not SLR(1). S AaAb BbBa A B Nov 2010 3 (i).illustrate the predictive parser for the following grammar. S (L) a L L, S S (ii).analyze, Is it possible, by modifying the grammar in any way to construct predictive parser for the language of S SS + SS * a the string aa+ a * May 2014 4 Evaluate predictive parsing table and parse the string id+id*id. E E+T T T T*F F F (E) id May 2016 5 Define SLR(1) parser. Predict the following grammar for generate the SLR parsing table. E E+T T T T*F F F F* a b May 2016 6 Analyze the following grammar is a LR(1) grammar and construct LALR parsing table. S Aa bac dc bda A d.parse the input string bdc. Using table generated by you. (ii).describe the conflicts that may occur during shift reduce parsing. 7 Give the predictive parser for the following grammar. S (L) a L L, S S a) Give a rightmost derivation for (a,(a, a)) and show the handle of each right-sentential form. b) Show the steps of a shift reduce parser. 8 (i).define YACC parser generator? List out the Error recovery actions in YACC? (ii).what are the Error recovery techniques used in Predictive parsing? 9 (i).what are the different kinds of syntax error phased by a program? (ii).list out different error recovery strategies.expalin them. Nov 2008 10 (i).describe the concepts of role of parser? (ii). what are the formal definition of a context-free grammar. UNIT-4-SYNTAX DIRECTED TRANSLATION & RUNTIME ENVIRONMENT 2 MARK QUESTIONS: 1 List out the two rules for type checking. May 2013 2 Define Syntax directed definition? 3 Define Annotated parse tree? May 2010 4 Define Type checker. May 2016

5 Define type expressions. 6 Define type systems. May 2016 7 Describe the rule for checking the type of a function. Nov 2009 8 Comparison between synthesized attributes and inherited attributes. 9 Explain about the S-attributed definition? May 2012 10 Give the difference between syntax-directed definitions and translation schemes. May 2016 11 Generalize the limitations of the static memory allocation? 12 What are the strategies apply in storage allocations? 13 Differentiate between stack and Heap allocation. 14 Create the target machine instructions to implement the call statement in static allocation. May 2016 15 Distinguish between static vs Dynamic storage allocation. 16 Test whether the following rules are L-attribute or not? Semantic rules A.s = B.b; B.i = f(c.c,a.s) May 2016 17 Describe the main idea of Activation tree? Nov 2009 18 Explain the fields in an Activation record. 19 Examine allocate the data of Fortan language? 20 Discuss the concepts of static allocation. 1 (i).discuss in detail about the Syntax Directed Definitions. (ii).discuss in detail about the specification of simple type checker Nov 2008 2 (i).evaluate the expressions for the SDD annotated parse tree for the following expressions. a) 3 * 5 + 4n b) 3 * 5. (ii).explain a type checker which can handle expressions, statements and functions. May 2016 3 Suppose that we have a production A BCD. Each of the four nonterminal A, B, C and D have two attributes: s is a synthesized attribute and i is an inherited attribute. Analyze For each of the sets of rules below tell whether (i) the rules are consistent with an S-attributed definition (ii) the rules are consistent with an L-attributed definition and (iii) whether the rules are consistent with any evaluation order at all? a) A.s = B.i + C.s b) A.s = B.i + C.s and D.i = A.i + B.s. 4 Apply the S-attributed definition and constructs syntax trees for a simple expression grammar involving only the binary operators + and -. As usual, these operators are at the same precedence level and are jointly left associative. All nonterminal have one synthesized attribute node, which represents a node of the syntax tree. Production: E E1 + T,E T, T ( E),T id/ num. May 2010 5 (i).discuss in detail about Syntax-Directed translation schemes. (ii).how names can be looked up in the symbol table? Discuss 6 (i).develop a quicksort algorithm for reads nine integers into an array a and sorts them by using the concepts of activation tree. (ii). Generalize the concepts of Type checking. May 2012 7 (i). How to a design a calling sequences and analyze the principles of activation records. (ii). Construct the unification algorithm by apply the type checking concepts. May 3013

8 (i).what are the uses of symbol-table? Describe the symbol table storage allocation information. (ii).comparison with tabulate between heap, stack and static allocation. Nov 2011 9 (i).describe the concepts of Storage allocation in FORTAN. (ii).describe in detail about dynamic storage allocation 10 (i).describe the source language issues in detail. (ii).describe in detail about storage organization. UNIT-5-CODE OPTIMIZATION AND CODE GENERATION 2 MARK QUESTIONS: 1 List out the examples of function preserving transformations? May 2010 2 How would you examine the dummy blocks with no statements indicated in global data flow analysis? 3 Name of the techniques in loop optimization. May 2012 4 How to solve the loop unrolling for given program. Int x; For( x =0; x<100;x++) { Delete(x); }. May 2011 5 Explain the applications of DAG 6 Define constant folding? May 2016 7 List out the properties of optimizing compilers? Nov 2009 8 Define the term data flow analysis? 9 Define live variable. May 2012 10 What is DAG? Point out advantages of DAG. May 2016 11 Describe the techniques of structure preserving transformations? May 2016 12 Discuss the concepts of basic blocks and flow graphs. 13 Give the main idea of dead code elimination. May 2016 14 Prepare the total cost of the following target code. MOV a, R0 ADD b, R0 MOV C, R0 ADD R0, R1 MOV R1, X Nov 2009 15 Construct and explain the DAG for the following basic block. d:= b * c e:= a+ b b:=b*c a:=e-d. 16 How would you solve the issues in the design of code generators? May 2016 17 Evaluate the minimum cost instruction sequence for a statement a= b+c. 18 Prepare and eliminate the common sub expression from the basic block. a:=b+c b:=a-d c:=b+c d:=a-d May 2016 19 Comparison between Register allocation and register assignment. Nov 2009 20 Discuss the topic on algebraic transformations?

1 (i).generalize the process of optimization of basic blocks. Give an example. (ii). Generalize the concept of register allocation and assignment May 2016 2 Define a DAG. Construct a DAG and Discover the sequence of instructions for a+a*(b-c)+(b-c)*d. 3 (i).explain in detail about the various issues in code generation with examples. (ii).explain the data flow analysis of structured programs May 2010 4 (i).explain in detail about global data flow analysis. (ii).for the code SUM = 0 do 10 i=1,n 10 SUM + a(i) * a(i). Write the following (i).three address code (ii). Local common sub expression elimination. (iii).reduction in strength. Nov 2011 5 (i).analyze and Generate code for the following assignment using the code generator algorithms (a-b) + (a-c) + (a-c). (ii).explain the concepts of global common sub expression elimination. May 2015 6 Optimize and develop this code by eliminating common sub expression, performing reduction in strength on induction variables and eliminating all the induction variable you can. t6 = 4 * i x = a[t6] t7 = 4 * i t8 = 4*j t9 = a[t8] a[t7] = t9 t10 = 4*j a[t10] = x goto B2. B2 : i = i+1 t2 = 4 * i t3 = a[t2] if t3 < a[t1] goto B2. May 2013 7 (i).discuss the code generation phase with simple code generation algorithm. (ii).discuss the various peephole optimization in detail May 2016 8 (i).define dataflow analysis? List out the procedures to analyze the data flow of structured programs? (ii).describe in detail about control flow analysis. 9 Describe the common examples of function preserving transformations and loop optimization process? 10 (i).describe the efficient data flow algorithms in detail. (ii).describe in detail about code improving transformations Nov 2013