CSC365 Compiler Design and Construction

Compiler Design and Construction old question papers

Pick a year on the left to see the full paper, exactly as it was set. 8 questions have come up in more than one paper.

12 questionsSit this paper (timed)

Tribhuvan University

Bachelor of Science in Computer Science and Information Technology

Semester 6 · TU Board 2081 (new course)

Course Title: Compiler Design and Construction (CSC365)

Full Marks: 60Pass Marks: 24Time: 3 hours

Candidates are required to give their answers in their own words as far as practicable. The figures in the margin indicate full marks.

Group A

Attempt any TWO question.(2 × 10 = 20)

  1. 1.

    Discuss about Directed Acyclic Graph with an example. Represent the expression A = (B + C) – (D – E) using 3AC, Quadruple and Triple.

    10
  2. 2.

    Create the LR(1) parsing table for following grammar.
    S → AA
    A → 0A
    A → ε

    10
  3. 3.

    Explain the optimization techniques for code optimization. Convert the following program to basic block and control flow.
    M = A + B
    N = C + D
    IF (M > N)
    X = M – N;
    ELSE
    E = M + N + X

    10

Group B

Attempt any EIGHT question.(8 × 5 = 40)

  1. 4.

    Compute the FIRST and FOLLOW of all the non-terminals in following grammar.
    S → AB
    A → 0A' | 1A' | ε
    A' → SSA' | ε
    B → AS | 1

    5
  2. 5.

    What are the operations performed in symbol table? Discuss about activation tree.

    5
  3. 6.

    What are the roles of macros and preprocessor? Discuss about one pass and multi pass compiler.

    5
  4. 7.

    Define explicit and implicit type conversion. Why do we need to check type of the system? Justify with an example.

    5
  5. 8.

    Differentiate between synthesized and inherited attributes with example.

    5
  6. 9.

    Construct the LL(1) parsing table for the following grammar.
    S → AS1 | C
    A → 0
    C → 2C | ε

    5
  7. 10.

    What are the advantages of intermediate code? How do you convert procedure call to 3AC?``

    5
  8. 11.

    What is a symbol table? Discuss the general structure of an LR parser.

    5
  9. 12.

    Generate the LR(0) item sets for the following grammar.
    A → BB
    B → bB | a

    5

— The End —