At&CD Important Questions Bank
At&CD Important Questions Bank
At&CD Important Questions Bank
3. List and explain the various phases of compiler and show the output of each
phase for the expression a=b + c * 25 (10M)
or
Explain the various phases of compiler and show the output of each phase for
the expression position=initial + rate * 60
4. Explain the different phases of a compiler with an example. (10M)
5. With a neat diagram explain the language processing system. (06M)
MODULE -2
b) identifiers
c) unsigned numbers
d) set of relational operators. (10M)
MODULE-3
6. Explain the left recursion and show how it is eliminated. Describe the
algorithm used for eliminating the left recursion. (06M)
OR
How left recursion can be eliminated from grammars? Write down the
simple arithmetic expression grammar and rewrite the grammar after
removing left recursion.
7. Describe an algorithm used for eliminating the left recursion. Eliminate left
recursion from the grammar:
S → Aa |b A →Ac | Sd | a.
(06M)
8. Explain the top down parsing and process for the string id+id*id. Given the
grammar,
E→E + E
E→ E * E
E→(E)
E→id
9. What are the key problems with top-down parse? Write a recursive descent
parser for the grammar: S →cAd A →ab | a
OR
Consider the production:
S →aAb A → cd|c.
Show that recursive-descent parsing fails for the input string “acdb”, also
explain recursive descent algorithm.
10. Explain with a neat diagram, the model of a table-driven predictive parser.(8M)
11. Explain how error recovery is done in predictive parsing. [6 marks]
@VTUpadhai
MODULE-4
Module-5
Module-1
1. Construction of DFA and NFA: Refer class work problems. (2M or 3M each)
2. Conversion of NFA to DFA. (10M)
3. Minimize the given DFA. (10M)
Module-2
1. Construct Regular expressions for the given languages.(2M or 3M each)
2. Using Rij(k)/Kleene’s method convert following FA to RE.
5. (ab*)*
6. (a U b)*abb
7. Prove that following languages are not regular using Pumping Lemma.
a. L={ an bn | n>=0}
b. L={wwR |wϵ{a,b}*}
c. L={aP |P is a prime number}
d. L={na(w)=nb(w) | wϵ{a,b}*}
e. L={an! :n>=0}
Module-3
1) Construct CFG for the following languages, (3marks each)
i. L = {02n 1m | m ,n ≥ 0}
ii. L={a n b m cn | m,n ≥ 0}
iii. L = {0m 1m 2n | m≥ 1 and n≥ 0}
iv. L={0i 1j | i≠j , i≥ 0, j≥ 0}
v. L={w: wϵ{a, b}* and w is palindrome}
vi. L={ai bj ck :i+j=k, i>=0,j>=0}
vii. L={an bm ck :n+ 2m=k}
viii. L={0i1j2k |i=j or j=k}
d. Show the moves made by the predictive parser on input (a, (a,a))
(12M)
6) Given the grammar:
S →aABb
A→c|ε
B→d|ε
i)Compute FIRST and FOLLOW sets
ii) Construct the predictive parsing table.
iii) Show the moves made by predictive parser on the input; acdb
MODULE -4
MODULE -5
Note:
• DFA can also be called DFSM, similarly NFA as NDFSM.
• (a+b) can be written as (aUb) also.
• Non recursive predictive parsing or LL(1) parser are same.
• CLR(1) can also be written as LR(1)
• All the problems refer ATC class work.
• All the above-mentioned questions are frequently asked in exams. But
don’t expect same questions in the exam.
• Prepare for both ATC and compiler part as it can be merged in both 1st part
and 2nd part of each questions.