IT-603 (A) · Compiler Design/Unsolved PYQ Paper
IT-603-A Compiler Design - Jun 2025 Question Paper
Under each question, How to answer lists the points an answer should cover, outlined by CampusPrep from the syllabus. Check the details against your textbook.
-
7 MarksaSpecify the reasons for separating the lexical analysis and syntax analysis.
How to answer
- Define roles of lexical analysis vs syntax analysis
- Simpler design and modularity
- Improved efficiency, portability and error handling
- Reasons: separation of concerns, regular vs context-free powers
-
7 MarksbExplain with an example how the lex program performs lexical analysis for identifiers and arithmetic operators.
How to answer
- Brief structure of lex program: definitions, rules, user subroutines
- Regular expressions for identifiers and arithmetic operators
- Example lex rules with actions returning tokens
- How lex generates lexical analyzer and token stream
-
7 MarksaConstruct the parse tree for the string $a+b*c$ using the grammar $E \rightarrow E+E \mid E*E \mid a \mid b \mid c$ by eliminating the ambiguity.
How to answer
- Rewrite ambiguous grammar $E \rightarrow E+E \mid E*E \mid a \mid b \mid c$ to enforce precedence
- Give unambiguous grammar with precedence of $*$ over $+$
- Show derivation steps for $a+b*c$
- Draw parse tree with $+$ at root and $b*c$ as right subtree
-
7 MarksbCompare SLR and LALR parsers.
How to answer
- Define SLR and LALR parsers and canonical collection basis
- Compare table size, power and construction method
- Compare resolving conflicts and lookaheads
- Give example grammar where LALR succeeds but SLR fails
-
14 MarksConstruct CLR(1) parsing table for the grammar $S \rightarrow L=R \mid R$ $R \rightarrow L$ $L \rightarrow *R \mid id$.
How to answer
- Augment grammar and compute LR(1) items and closures
- Construct canonical collection of sets for $S \rightarrow L=R \mid R$, $R \rightarrow L$, $L \rightarrow *R \mid id$
- Compute GOTO and ACTION with lookaheads
- Present CLR(1) parsing table with shift/reduce/accept entries
-
7 MarksaExplain bottom up evaluation of S-Attributes with an example.
How to answer
- Define S-attributed grammar with only synthesized attributes
- Explain bottom-up evaluation using LR parser stack with semantic values
- Give example with annotated parse tree / stack actions
- Order of evaluation follows post-order traversal
-
7 MarksbExplain how an L-attributed grammar is converted into a translation scheme.
How to answer
- Define L-attributed grammar and restriction on inherited attributes
- Explain embedding actions and marker non-terminals
- Steps to convert inherited/synthesized rules into translation scheme
- Example with traversal order and stack implementation
-
7 MarksaExplain dependency graph with an example.
How to answer
- Define dependency graph for attribute instances in parse tree
- Explain nodes as attributes and edges as dependencies
- Give example grammar with parse tree and graph
- Use for evaluation order and cycle detection
-
7 MarksbWrite the different intermediate forms for the equation $d = (a-b) + (a-c) + (a-c)$.
How to answer
- Write three-address code / quadruples / triples for $d=(a-b)+(a-c)+(a-c)$
- Show syntax tree and DAG representation
- Show postfix / prefix notation
- Compare forms and common subexpression handling
-
7 MarksaDiscuss the various data structures used to implement the symbol table.
How to answer
- Define symbol table purpose and operations
- Describe list, hash table, binary tree structures
- Describe scoped / hash with chaining and open addressing
- Compare search, insert, memory and scope handling
-
7 MarksbExplain in brief about the Heap Storage allocation strategy?
How to answer
- Define heap allocation and dynamic lifetime
- Explain malloc/free, fragmentation and garbage collection
- Contrast with stack and static allocation
- Give example of activation with variable-size data
-
7 MarksaExplain optimization of basic blocks.
How to answer
- Define basic blocks and leaders
- Explain DAG construction and local transformations
- List optimizations: common subexpression, dead code, strength reduction
- Show example before and after optimization
-
7 MarksbCompare reducible and non reducible flow graphs.
How to answer
- Define flow graphs, dominators and back edges
- Define reducible vs non-reducible graphs
- Compare with examples and effect on data-flow analysis
- Mention transformation to reducible form
-
14 MarksWrite short notes on any two of the following.
- a)Bootstrapping
- b)Operator precedence parser
- c)Dependency graph
- d)Activation record
How to answer
- Select any two topics from four options
- Give definition, working and diagram for each
- Mention use in compiler phases with example
- Conclude with advantages/limitations
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 accountHave an account? Log in
Notes Panel