0% found this document useful (0 votes)
65 views4 pages

CS8602 Compiler Design Part B - QB

This document contains 20 questions related to compiler design. The questions cover topics like the phases of a compiler, lexical analysis, syntax analysis using techniques like LL(1) and LR parsing, intermediate code generation using three address code, and code optimization. Some questions ask to construct parsing tables, eliminate left recursion from grammars, parse sample inputs, and explain compiler concepts in detail. The document provides a question bank for a compiler design course to test students' understanding of key compiler topics.

Uploaded by

Swetha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views4 pages

CS8602 Compiler Design Part B - QB

This document contains 20 questions related to compiler design. The questions cover topics like the phases of a compiler, lexical analysis, syntax analysis using techniques like LL(1) and LR parsing, intermediate code generation using three address code, and code optimization. Some questions ask to construct parsing tables, eliminate left recursion from grammars, parse sample inputs, and explain compiler concepts in detail. The document provides a question bank for a compiler design course to test students' understanding of key compiler topics.

Uploaded by

Swetha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

AVS COLLEGE OF TECHNOLOGY


YEAR / SEM.: III / VI
Attur Main Road, Near AVS College of Arts and Science, CS6660 –COMPILER DESIGN
PART-B
Chinnagoundapuram, Salem – 636 106
UNIT- I INTRODUCTION TO COMPILER

1. Write down the exclusive functions carried out by the analysis


phases of any compiler. [May 10] (8)
2. Discuss the cousins of compiler. [Dec 13] (8)
3. What are the various phases of the compiler? Explain each phase
in detail. [Dec 13, May 12, May 10] (16)
4. Explain in detail the process of compilation. Illustrate the output
Department of Computer Science and Engineering of each phase of compilation for the input “a=(b+c)*(b+c)*2”.
[June 14] (16)
5. What are the major data structures used in a compiler? Describe
III Year / VI Semester what is represented by each of them. [May 11] (8)
6. Explain the need for grouping of phases of compiler. [Dec 14] (8)
7. Briefly explain the compiler construction tools. [May 15] (8)
8. Explain in detail the role of lexical analyzer with possible error
QUESTION BANK recovery actions. [May 11,15] (8)
9. What are the issues of the lexical analyzer? Explain. [May 12] (8)
CS8602 – COMPILER DESIGN 10. Explain briefly about input buffering in reading the source
program for finding the tokens. [Dec 11] (8)
11. Elaborate in detail the recognition of tokens. [May 12] (12)
12. Explain briefly the design of lexical analyzer. [Dec 10] (8)
13. Explain in detail about DFA with example. (8)
14. Explain in detail about NFA with example. (16)

Prepared By 15. Write an algorithm to construct an NFA into a regular


expression. [Dec 10] (8)

Mr. V.GURUNATHAN 16. Prove that the following two regular expressions are equivalent
by showing that the minimum state DFA’s are same.
i) (a/b)* ii) (a*/b*)* [Dec 09, May 15] (16)
ASSISTANT PROFESSOR
17. Illustrate Thomson’s construction by drawing a NFA for the
regular expression (a/b)*a. Convert this NFA to DFA using
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
subset construction. Write the algorithm for subset construction. Construct a predictive parsing table for the grammar shown
[May 11] (16) above. Verify whether the input string id + id * id is accepted by
18. Construct the minimized DFA for the regular expression the grammar or not. [Dec 05] (12)
(0+1)*(0+1) 10. [Dec 11] (8) 8. (i) Construct the predictive parser for the following grammar.
19. Draw the DFA for the augmented regular expression (a/b)*# S→(L)|a
directly using syntax tree. [Dec 13] (12) L→L, S|S
20. Construct a DFA directly from an augmented regular expression (ii) Construct the behavior of the parser on the sentence (a,a)
((Ɛ/a)b*)*. [Dec 12] (10) using the grammar specified above. [May 07,12,13] (10)
21. Construct DFA to recognize the language (a/b)*ab. Pg.No.2.50 9. Check whether the following grammar is LL(1) grammar.
[May 16] (8) S→iEtS/iEtSeS/a
22. Explain in detail about LEX. (8) E→b.
23. Explain in detail to convert NFA with Ɛ to without Ɛ with Also define FIRST and FOLLOW procedures. [May 16] (8)
example. (8) 10. Construct non recursive predictive parsing table for the
following grammar.
E→E or E| E and E| not E| (E)| 0| 1. [Dec 12] (16)
UNIT - II SYNTAX ANALYSIS 11. Explain in detail about Bottom-up Parsing with example.
1. Explain in detail about Context Free Grammar.[Dec 05, May 16] [May 10,11,16] (8)
(10) 12. Consider the grammar
2. What is an ambiguous grammar? Is the following grammar E→E + E
ambiguous? Prove E→E+E|E*E|(E)|id. The grammar should be E→E * E
moved to the next line, centered. [May 14] (8) E→ id
3. Explain in detail about Top-down Parsing with example. Perform Shift-Reduce parsing of the input string “id1+id2+id3”.
[May 15] (10) [May 16] (8)
4. Eliminate the left recursion from the following grammar A→Ac| 13. Explain in detail about Operator Precedence Parser with
Aad|bd|c. [May 07] (10) example. [May 06] (8)
5. Write down the algorithm to eliminate left-recursion and left 14. Explain in detail about Simple LR Parser (SLR) with example.
factoring and apply both to the following grammar. [May 11,13,14,15] (16)
E→E+T|E-T|T 15. Construct the SLR(1) parsing table for
T→a|b|(E) [May 15] (8) E→E+T
6. Explain in detail about Predictive Parsing LL(1). [May 11,12,16] E→T
(16)
T→T * F
7. Consider the grammar
T→F
E → TE’
F→ (E)
E’ → + TE’ / Ɛ
T → FT’ F→ id
T’ → *FT’ / Ɛ [May 11] (10)
F → (E) / id 16. List all LR(0) items for the following grammar
S→AS/b 5. Write a top-down translation scheme to produce quadruples for
A→SA/a [May 13] (8) Boolean expression. (8)
17. Generate SLR parsing table for the following grammar 6. Discuss specification of a simple type checker. [May 16] (8)
S→Aa|bAc|Bc|bBa 7. What are the various methods of implementing three address
A→d statements? [May 11,13] (16)
B→d 8. Describe the various types of three address statements.
and parse the sentence “bdc” and “dd” [May 12] (8)
[May 15] (10) 9. Explain the various types of assignment statements. [May 11,13,14]
18. Explain the LR parsing algorithm in detail. (8) (8)
19. Explain in detail about LALR parsing algorithm with example. 10. Translate the following integer array operation into three address
[Dec 06,07,13] (16) code. A[i,j] := B[i,j] + C[k] where A and B are of size 10 x 20
20. Give the LALR parsing table for the grammar. and C contains 50 elements. [May 10] (16)
S→L=R/R 11. Discuss the various methods for translating the Boolean
L → * R / id expression. [May 11,12] (12)
R→L [Dec 06,07] (12) 12. Explain in detail about Case statement. [May 08,14] (16)
21. Compare SLR, LALR and LR parses. (8)
13. Write short note on procedures calls. [Dec 11,13] (8)
22. Explain in detail about the error recovery strategies in paring. 14. Explain in detail about back patching. [May 13,14] (8)
[May 06,07,11] (8)
23. Explain in detail about YACC. UNIT - IV RUN-TIME ENVIRONMENT AND CODE
GENERATION
UNIT-III INTERMEDIATE CODE GENERATION
1. Explain in detail about the storage organization. [May 07] (10)
2. Discuss different storage allocation strategies. [May 11,13,14,16]
1. Explain in detail about Syntax-Directed translation. (16)
[May 15] (8)
2. Give a syntax definition to differentiate expressions formed by 3. Distinguish between the source text of a procedure and its
applying the arithmetic operators + and * to the variable x and activation at own time. [May 11] (8)
constants; expression x * ( 3 * x + x * x ). [May 15] (8) 4. Discuss various ways of implementing symbol table and
3. What is attributed Grammar? Explain with suitable example. compare merits and demerits. May 12, Dec 06,07,10] (8)
(8) 5. Explain in detail about Dynamic storage allocation techniques.
4. Construct a syntax directed definition for constructing a syntax (8)
tree for assignment statements. [May 16] (8)
6. What are the issues to be handled during code generation?
S→id := E
Explain how these issues are handled. Give examples to support
E→E1 + E2
your explanation. [May 11,12,14,16, Dec 10] (16)
E→E1 * E2
7. Explain in detail about simple code generator algorithm with
E→ -E1
example. [May 10,11,12,15,16, Dec 11,14] (16)
E→ (E1)
E→ id
8. Generate assembly language for W : = (A+B) + (A+C) + (A+C). 9. What are the sources of redundancy in code? Give examples
[May 10] (8) using flow graphs. When is a flow graph said to be reducible?
9. Write a code generation algorithm to generate code machine What are the properties of natural loops? [May 11] (16)
instructions for operations and copy statements. Indicate the use 10. Discuss in detail about global data flow analysis. [Dec 13] (16)
of register and address descriptors in code generation. Trace the 11. Explain in detail about the dataflow analysis concept with
algorithm and show the code generated for the following three suitable example. [May 12,14] (16)
address statements: [May 11] (16) 12. Explain in detail about efficient dataflow algorithms with
t =a-b suitable example. [May 13, Dec 09] (16)
u=a-c
v=t+u
a=d
d=v+u
10. Construct DAG and optimal target code for the expression
x = ( (a+b) / (b-c) – (a+b) * (b-c) + f SUBJECT I/C HOD IQAC PRINCIPAL
[May 15] (8)

UNIT - V CODE OPTIMISATION


1. Explain in detail about principle sources of Optimization.
[May 10,11,16, Dec 13,14] (16)
2. Explain in detail about Loop Optimization. [May 11, Dec 13] (8)
3. Explain in detail about Peephole Optimization.[May 11, Dec 13,14]
(16)
4. Explain in detail about the basic blocks and flow graphs with
example. [May 10,11,12,15, Dec 10] (16)
5. Explain the DAG representation of the basic block with and
example. [May 05,07] (10)
6. Generate DAG representation of the following code and list out
the applications of DAG representation.
i = 1, s = 0
while ( i < 10)
s = s + a[i][i]
i= i+1
[May 08, Dec 13] (16)
7. Describe in detail about optimization of basic blocks with
example. [May 14, Dec 07,11] (16)
8. Explain in detail about the Loops and flow graphs with example.
[May 10,11] (16)

You might also like