Compiler Design and Construction (CSC376) 2082 BS Past Questions & Solutions

Tribhuvan University (TU) 2082 BS board exam question paper with verified step-by-step solutions for BSc CSIT Sixth Semester.

TRIBHUVAN UNIVERSITY

INSTITUTE OF SCIENCE AND TECHNOLOGY

2082 B.S.

Bachelor Level: B.Sc. CSIT

Semester: Sixth Semester

Subject: Compiler Design and Construction (CSC376)

Full Marks: 60 / 80

Pass Marks: 24 / 32

Candidates are required to give their answers in their own words as far as practicable.

Group A

Long Answer Questions

Attempt any Two questions.

  1. 1
    Define important state. Why do we need augmented regular expression? Convert the regular expression $(a+b)^*a(a+b)$ to DFA.
  2. 2
    How do you create control flow graph from basic block? Explain the need and criteria for code optimization.
  3. 3
    List some limitations of Recursive Descent Parsing. Construct a syntax directed translation scheme that translates arithmetic expression from infix notation into postfix notation. Also create an annotated parse tree for the input $9 - 5 + 2$.

Group B

Short Answer Questions

Attempt any Eight questions.

  1. 4
    Simulate the process of execution in different phases of compiler for the statement $A * B + C - 2.5$.
  2. 5
    Define tokens, pattern and lexemes. Mention about the conflicts in shift-reduce parsing.
  3. 6
    Explain the types of data structures used in symbol table.
  4. 7
    Convert the following expression to 3AC. ``` A = B + C + D E = D - A * C MUL(A, E) ```
  5. 8
    Discuss the role of parser. Describe the language generated by the grammar $S \to SS+ \mid SS^* \mid a$.
  6. 9
    Compute the LR(0) item set for the grammar, $S \to aSa \mid bSb \mid d$.
  7. 10
    What do you understand by left-recursion and left-factoring? Discuss about type conversion.
  8. 11
    Define inherited and synthesized attribute. Compute the FOLLOW in the following grammar. $S \to (L) \mid b$, $L \to SL'$, $L' \to ,SL' \mid \epsilon$
  9. 12
    Why do we need to check the type? Distinguish between DAG and syntax tree.
Compiler Design and Construction (CSC376) 2082 BS Past Questions | BSc CSIT 6th Sem