Consider the following grammar:
E → E+T | T
T → T*F | F
F → (E) | id
Draw a SLR state transition diagram for the above grammar. Also draw the SLR table.
STATE TRANSITION DIAGRAM:
FOLLOW(E)=FOLLOW(E')={),$}
FOLLOW(T)=FOLLOW(T')={+,),$}
FOLLOW(F)={*,+,),$}
SLR PARSING TABLE:
Show that no left recursive grammar can be LL(1). Show that no LL(1) grammar can be ambiguous.
Write short notes on:
What is Basic Block? List out the basic blocks and draw the flow graph for the following code:
1. |
location= -1 |
2. |
i=0 |
3. |
i<100 goto 5 |
4. |
goto 13 |
5. |
t1=4*i |
6. |
t2=A[t1] |
7. |
if t2=x goto 9 |
8. |
goto 10 |
9. |
location=i |
10. |
t3=i+1 |
11. |
i=t3 |
12. |
goto 3 |
13. |
… |
Discuss the ACID properties of transaction.
Write a C program to find the roots of a quadratic equation.
Write a C program to addition of two matrices.
Write a C program to find the factorial of any number.