TRIBHUVAN UNIVERSITY
INSTITUTE OF SCIENCE AND TECHNOLOGY
2082 B.S.
Candidates are required to give their answers in their own words as far as practicable.
Group A
Long Answer QuestionsAttempt any Two questions.
- 1Define important state. Why do we need augmented regular expression? Convert the regular expression $(a+b)^*a(a+b)$ to DFA.
- 2How do you create control flow graph from basic block? Explain the need and criteria for code optimization.
- 3List 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 QuestionsAttempt any Eight questions.
- 4Simulate the process of execution in different phases of compiler for the statement $A * B + C - 2.5$.
- 5Define tokens, pattern and lexemes. Mention about the conflicts in shift-reduce parsing.
- 6Explain the types of data structures used in symbol table.
- 7Convert the following expression to 3AC. ``` A = B + C + D E = D - A * C MUL(A, E) ```
- 8Discuss the role of parser. Describe the language generated by the grammar $S \to SS+ \mid SS^* \mid a$.
- 9Compute the LR(0) item set for the grammar, $S \to aSa \mid bSb \mid d$.
- 10What do you understand by left-recursion and left-factoring? Discuss about type conversion.
- 11Define inherited and synthesized attribute. Compute the FOLLOW in the following grammar. $S \to (L) \mid b$, $L \to SL'$, $L' \to ,SL' \mid \epsilon$
- 12Why do we need to check the type? Distinguish between DAG and syntax tree.