2081

CDC 2081

Section A

Attempt any TWO questions.

  1. Give an example of reduce-reduce conflict. Construct the SLR parsing table for the following grammar.

    E→ (L) | a
    L → L, E | E

  2. What are the significances of intermediate code? Differentiate between DAG and Syntax tree. Represent the instruction A = B + C − D * E + G using quadruple and triple.

  3. Illustrate the concept of backpatching with an example. Convert the regular expression a(a + b)a# to DFA.

Section B

Attempt any TWO questions.

  1. Explain different phases of compiler in brief.

  2. What types of information are stored in a symbol table? Discuss the activation record.

  3. Compute the FIRST and FOLLOW of the non-terminals in the following grammar:
    S → (L) ∣ 1
    L → LS ∣∗S

  4. Write the code generation algorithm for the instruction a = b op c.

  5. Define core item. Compute the LR(1) item sets for the following grammar:
    S → AA
    A → aA ∣ b

  6. How do you represent recursion in an activation tree? Generate the three-address code for the following instruction:

    n = (a + b) * (c - d);

    for(i = 0; i < n; i++) {

    for(j = 0; j < n; j++) {

    x = n + i + j;

    }

    }

  7. What are the techniques for compiler optimization? Explain.

  8. Describe the synthesized attribute and inherited attribute with an example.

  9. What is a type expression? List the properties of LL(1) grammar.