TRIBHUVAN UNIVERSITY
INSTITUTE OF SCIENCE AND TECHNOLOGY
2081 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.
- 1Discuss about Directed Acyclic Graph with an example. Represent the expression $A=(B+C)-(D-E*F)$ using 3AC, Quadruple and Triples.
- 2Create the $LR(1)$ parsing table for following grammar. $S \rightarrow AA$ $A \rightarrow 0A$ $A \rightarrow 1$
- 3Explain 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 { X = M + N } E = M + N + X ```
Group B
Short Answer QuestionsAttempt any Eight questions.
- 4Compute the FIRST and FOLLOW of all the non-terminals in following grammar. $S \rightarrow AB$ $A \rightarrow 0A' | 1A' | \epsilon$ $A' \rightarrow SSA' | \epsilon$ $B \rightarrow AS | 1$
- 5What are the operations performed in symbol table? Discuss about activation tree.
- 6What are the roles of macros and preprocessor? Discuss about one pass and multi pass compiler.
- 7Define explicit and implicit type conversion. Why do we need to check type of the system? Justify with an example.
- 8Differentiate between synthesized and inherited attributes with example.