CS1352 Principles of Compiler Design Question Bank : kings.ac.in
Name of the College : Kings College Of Engineering
Department : Computer Science & Engineering
Subject : Principles of Compiler Design
Website : kings.ac.in
Document Type : Question Bank
Download Model/Sample Question Paper : https://www.pdfquestion.in/uploads/ki…8-PCD%20QB.pdf
Kings Principles of Compiler Design Question Paper
UNIT I
INTRODUCTION TO COMPILING :
PART – A :(2MARKS)
1. Define a compiler?
2. Describe the Analysis-Synthesis Model of compilation.
3. Define a symbol table.
Related : Kings College Of Engineering CS1451 Network Protocols Question Bank : www.pdfquestion.in/293.html
4. What are the functions of preprocessors?
5. Define Assembly Code.
6. Define tokens, Patterns and lexemes.
7. What are the possible error-recovery actions in lexical Analyzer?
8. What are the three general approaches to the implementation of a Lexical Analyzer?
9. Define a Sentinel.
10. Describe briefly rational preprocessors with an example.
11. What are the reasons for separating the analysis phase of compiling into Lexical analysis and parsing?
12. What is the function of a loader?
13. Give the diagrammatic representation of a language processing system.
14. Explain briefly the producer-consumer pair of a lexical analyzer and parser.
15. Mention the issues in a lexical analyzer.
16. Mention some of the cousins of the compiler.
17. What are rational preprocessors?
PART – B :
1. Explain in detail about the role of Lexical analyzer with the possible error recovery actions. (16)
2. (a)Describe the following software tools
i. Structure Editors ii. Pretty printers iii. Interpreters (8)
(b)Write in detail about the cousins of the compiler. (8)
3. Describe in detail about input buffering. What are the tools used for constructing a compiler? (16)
4. (a)Explain the functions of the Lexical Analyzer with its implementation. (10)
(b)Elaborate specification of tokens. (6)
5. (a)What is a compiler? Explain the various phases of compiler in detail, with a neat sketch. (10)
(b) Elaborate on grouping of phases in a compiler. (6)
6. (a) Explain the various phases of a compiler in detail. Also write down the output for the following expression after each phase a :=b*c-d. (8)
(b) What are the phases of the compiler? Explain the phases in detail. Write down the output of each phase for the expression a : = b + c * 50. (8)
UNIT II
SYNTAX ANALYSIS :
PART – A : (2MARKS)
1. Draw a NFA for a*|b*.
2. What do you mean by Handle Pruning?
3. Define LR (0) items.
4. What do you mean by viable prefixes?
5. Define handle.
6. What are the algebraic properties of regular expressions?
7. What is finite automata?
8. What are the goals of error handler in a parser?
9. What is an ambiguous grammar? Give an example.
10. What is phrase level error recovery?
11. What are the disadvantages of operator precedence parsing?
12. What is a predictive parser?
13. Eliminate left recursion from the following grammar A->Ac/Aad/bd/c.
14. What is LL (1) grammar? Give the properties of LL (1) grammar.
15. Give the algorithm for Left Factoring a Grammar.
16. What is Left Recursion? Give an example for eliminating the same.
PART – B :
1. What is FIRST and FOLLOW? Explain in detail with an example. Write down the necessary algorithm. (16)
2. Construct Predictive Parsing table for the following grammar :
S -> (L) / a
L -> L, S/S
and check whether the following sentences belong to that grammar or not.
(i) (a,a)
(ii) (a, (a , a))
(iii) (a, ((a , a), (a , a)) ) (16)
3. (a) Construct the predictive parser for the following grammar :
S -> (L)|a
L -> L,S|S. (12)
(b) Construct the behaviour of the parser on sentence (a, a) using the grammar :
S -> (L)|a
L -> L,S|S. (4)
4. (a) Check whether the following grammar is SLR (1) or not. Explain your answer with reasons.
S-> L=R
S->R
L->*R
L->id
R->L (8)
(b) For the grammar given below, calculate the operator precedence relation and the precedence functions.
E -> E + E | E – E | E * E | E / E | E ^ E | (E) | -E | id (8)
5. Check whether the following grammar is a LL(1) grammar
S -> iEtS | iEtSeS | a
E -> b
Also define the FIRST and FOLLOW procedures. (16)
6. (a) Consider the grammar given below.
E->E+T
E->T
T->T*F
T->F
F->(E)
F->id.
Construct an LR Parsing table for the above grammar. Give the moves of LR parser on id*id+id. (12)
(b) What is a shift-reduce parser? Explain in detail the conflicts that may occur during shift- reduce parsing. (4)
Goals of a error handler?
We want the solved questions with solutions.
Please provide with solutions.