CSC365 Compiler Design and Construction

Compiler Design and Construction TU Board 2076 question paper

10 questionsSit this paper (timed)

Tribhuvan University

Bachelor of Science in Computer Science and Information Technology

Semester 6 · TU Board 2076

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 all question.

  1. 1.

    Explain briefly about different phases involved in compiler, with a block diagram

  2. 2.

    Given a regular expression (ε + 0)*10. Construct the DFA recognizing the pattern described by this regular expression using syntax
    tree based reduction.

  3. 3.

    What is shift reduce parsing techniques? Show shift reduce parsing action for the string (x+x)*a, given the grammar

  4. 4.

    Construct SLR parsing table for the following grammar.
    S -> aAa | bAb | ba

  5. 5.

    Define Syntax directed definition. Construct annotated parse tree for the input expression (5*3+2)*5 according to the following
    syntax directed definition.

    [figure in the original paper]

  6. 6.

    Write Syntax Directed Definition to carry out type checking for the following expression.
    E -> id | E1 op E2 | E1 relop E2 | E1[E2] | E1 ↑

  7. 7.

    Explain with example about different methods of intermediate code representation.

  8. 8.

    What is the purpose of code optimization? Explain different types of loop optimization techniques with example.

  9. 9.

    Discuss about the different factors affecting target code generation.

  10. 10.

    Discuss the importance of error handler in compiler. How is it manipulated in the different phases of compilation?

— The End —