Skip to content
CS-603 · Compiler Design/Unsolved PYQ Paper

CS-603 Compiler Design - Dec 2024 Question Paper

  1. 8 Marks
    aWhat is a translator? Compare compiler and interpreter in terms of translation method, memory requirement and speed.
  2. 3 Marks
    bExplain LEX tool in brief.
  3. 3 Marks
    cWhat is left factoring in grammar? Explain with an example.
  4. 6 Marks
    aConsider the following grammar for list structures: $$S \rightarrow a / \wedge(T)$$ $$T \rightarrow T,S / S$$ Find left most derivation, right most derivation and parse tree for the string $(((a,a),\wedge(a)),a)$.
  5. 4 Marks
    bFor the following grammar find First and Follow sets for each of non-terminal. $$S \rightarrow aAB / bA / \varepsilon$$ $$A \rightarrow aAb / \varepsilon$$ $$B \rightarrow bB / \varepsilon$$
  6. 4 Marks
    cDescribe the following in brief. i) Ambiguity ii) Left recursion
  7. 8 Marks
    aWhat is parser? Explain backtracking and non-backtracking parsers with their types.
  8. 6 Marks
    bConsider the following grammar. $$E \rightarrow E + T$$ $$T \rightarrow TF / F$$ $$F \rightarrow F* / a / b$$ Construct the SLR Parsing table for this grammar.
  9. 8 Marks
    aDefine the following with an example. i) Synthesized attributes ii) Annotated parse tree iii) Dependency graph
  10. 6 Marks
    bGenerate the three address code for the following code segment: While (a < c and b < d) do If a = 1 then c = c + 1. Else While (a <= d) do a = a + 3
  11. 8 Marks
    aExplain various intermediate code generation techniques in brief.
  12. 6 Marks
    bConsider the grammar with the following translation rules and E as the start symbol. $$E \rightarrow E1 \# T \; \{E.value = E1.value * T.value\}$$ $$| T \; \{E.value = T.value\}$$ $$T \rightarrow T1 \& F \; \{T.value = T1.value + F.value\}$$ $$| F \; \{T.value = F.value\}$$ $$F \rightarrow num \; \{F.value = num.value\}$$ Compute E.value for the root of the parse tree for the expression. $$2 \ll 3 \& 5 \# 6 \& 4$$
  13. 6 Marks
    aWrite an algorithm to construct a DAG from a basic block.
  14. 8 Marks
    bWhat is S-attributed SDT & L-attributed SDT? Consider the following grammar and write the SDT rules for the given grammar. $$S \rightarrow S * A$$ $$S \rightarrow A$$ $$A \rightarrow A + B$$ $$B \rightarrow (S)$$ $$A \rightarrow B$$ $$B \rightarrow id$$
  15. 7 Marks
    aWrite the differences between Synthesized and inherited attributes.
  16. 7 Marks
    bExplain the common sub expression, elimination, copy propagation, and Transformation for moving loop invariant computations in detail.
  17. 4 Marks
    aWhat is Local transformation and Global transformation.
  18. 10 Marks
    bWhat are the 3 areas of code optimization? Explain each one in detail.
Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in