0% found this document useful (0 votes)
32 views6 pages

CD Important Questions + Numerical (Edushine)

The document outlines key concepts in compiler design across five units, including bootstrapping, finite state machines, parsing techniques, syntax-directed translation, symbol tables, and code generation. It provides exercises and questions related to constructing NFAs, parsing tables, and code optimization. Each unit focuses on foundational topics essential for understanding compiler construction and operation.

Uploaded by

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

CD Important Questions + Numerical (Edushine)

The document outlines key concepts in compiler design across five units, including bootstrapping, finite state machines, parsing techniques, syntax-directed translation, symbol tables, and code generation. It provides exercises and questions related to constructing NFAs, parsing tables, and code optimization. Each unit focuses on foundational topics essential for understanding compiler construction and operation.

Uploaded by

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

Important Unit-1

Unit 1: Introduction to Compiler


1. What is bootstrapping and cross-compiler?
2. Describe the relationship between finite state machines and regular
expressions. Discuss how regular expressions are used in lexical analysis and
pattern matching.
3. Given a regular expression a(b|c)*, construct the corresponding
Nondeterministic Finite Automaton (NFA) that recognizes the language
described by the regular expression
4. Check whether given grammar is ambiguous or not. If ambiguous then convert
it into unambiguous grammar: E→E+E|E*E|id.
5. Construct the NFA and DFA for the following regular expression.
(0+1)*(00+11)(0+1)*
6. Construct predictive parse table for the following grammar.
E → E + T/T
T →T *F/F
F →F /a/b
Important Unit-2

Unit 2: Basic Parsing Techniques


1. Consider the following grammar for a simple expression language:
E→E+T|T
T→T*F|F
F → ( E ) | id
Consider expression id * (id+id). Apply shift reduce parsing to construct parse
tree.
2. Check whether the given grammar is LR(0) or not: S→PQy, P→Sy|x, Q→yS.
3. Construct the Operator precedence parsing parsing table for the following
Grammar.
E → E+T/T
T → T*F/F
F → id
4. Construct the SLR parsing table for the following Grammar.
S→ 0S0
S→ 1S1
S→ 10
5. Construct the CLR parse table for the following Grammar:
A→BB
B→cB
B→d
Important Unit-3

Unit 3: Syntax-directed Translation


1. Differentiate between synthesized and inherited attributes. Write Syntax
directed definition of a simple desk calculator.
2. Write syntax directed definition for a given Important statement:
S → id=E
E → E+E
E →E*E
E→-E
E → (E)
E→id
3. Translate the following arithmetic expression into quadruples and triples:
i. (𝑥 + 𝑦) ∗ (𝑦 + 𝑧) + (𝑥 + 𝑦 + 𝑧)
ii. 𝑎 = -𝑏 ∗ (𝑐 + 𝑑) + 𝑏
4. What is back patching. Generate three address code for the following
Boolean expression using back patching:
a < b or c > d and e < f
5. Write the three-address code for the statement given below:
while a < b do
if c < d then
x=y*z
else
x=y+z
Important Unit-4

Unit 4: Symbol Tables & Run-Time Administration


1. Define Symbol table? Explain about the data structures used for symbol table.
2. Discuss the stack allocation and heap allocation strategies of the runtime
environment with an example.
3. Draw the format of Activation Record in stack allocation and explain each
field in it.
4. What do you understand by lexical phase error and syntactic error? Also
suggest methods for recovery of errors.
5. Define semantic errors in a compiler. Discuss the challenges associated with
detecting and handling semantic errors. Provide examples to illustrate
semantic issues.
Important Unit-5

Unit 5: Code Generation and Optimization

1. What are basic blocks? Write the algorithm for partitioning into Blocks.
2. Explain in detail about loop optimization.
3. Construct the flow graph for the following code segment:
fact(n)
{
int f=1;
for(i=2; i≤n; i++)
f=f*i;
return f;
}

4. Define a DAG. Construct a DAG for the expression:


p+p*(q-r)+(q-r)*s

5. What are the various issues in design of code generator & code loop optimization?

6. Write a short note on:


a. Flow graph (with example)
b. Dominators
c. Natural loops
d. Inner loops
e. Reducible flow graphs
f. Copy Propagation
g. Dead-Code Elimination
h. Code Motion
i. Reduction in Strength.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy