ATCD
ATCD
Draw a DFA to accept set of all string of a’s and b’s ending with ab or ba
2. Convert the following NFA to its equivalent DFA
3. Obtain a regular expression representing strings of a’s and b’s such that third symbol from
the right is “a” and fourth symbol from the right is “b”.
4. Construct leftmost derivation and right most derivation for the string aaabbabbba using the
following grammar.
S→aB/bA
A→a/aS/bAA
B→b/bS/aBB
7. Draw a DFA to accept string of a’s and b’s having a substring aab
8. Obtain the DFA for the following NFA
9. Obtain a regular expression representing string of a’s and b’s whose tenth symbol from the
right is a.
10. Construct a DFA which accepts strings of 0’s and 1’s where the value of each string is
represented as a binary number. Only the strings representing zero modulo five should be
accepted.
11. Define Context Free Grammar and construct CFG to generate a palindrome over {a,b}
12. Consider the following grammar:
E→E+E ∣ E∗E ∣ id
Construct two different parse trees for the expression id + id * id and determine whether the
grammar is ambiguous
13. Draw a DFA to accept set of all strings on the alphabet Ʃ={0,1} that either begins or ends or
both with the substring 01.
14. Design an NFA to recognize the following set of stings abc, abd and aacd
15. Obtain a regular expression such that L(R)={W|W ∈{0,1}*} with at least three consecutive
0’s
16. A toll booth charges a fee based on the sum of coins inserted. The machine only allows cars
to pass if the total amount inserted is divisible by 3. Design a DFA to determine whether the
sum of inserted coins is divisible by 3.
17. Convert the following epsilon NFA to equivalent NFA
UNIT 2
70. Write design issues in code generator and explain memory manager
71. Write the quadruples, triples and indirect triples for the expression –(a+b) + (c+d)
72. Assume a procedure P has 4 local variables (each 4 bytes) and calls another procedure Q
that needs 3 parameters. If the return address takes 8 bytes, compute the total stack space
allocated when P calls Q
73. Consider the following three-address code. Draw its DAG representation. Show the DAG
after labelling using the labelling algorithm
t1 =a+b
t2 =c+d
t3=e-t2
t4=t1-t3
74. Explain the different storage allocation strategies.
75. Write a three-address code for the following C statement
if((a<b) and ((c<d) or (a>d))
Then z= x + y*z
else z= z+1