IT-603 (A) · Compiler Design/Unsolved PYQ Paper
IT-603-A Compiler Design - May 2023 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 MarksaList out different phases of the compiler and explain each phase's role in the compilation process.
How to answer
- List six phases: lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, code generation plus symbol table and error handler
- Explain input to output of each phase with example a=b+c*2
- Show block diagram of compilation flow
-
7 MarksbDiscuss how Finite Automata is used to recognize tokens and perform lexical analysis with an example.
How to answer
- Define token, lexeme, pattern and finite automata DFA/NFA
- Explain transition diagram for identifiers, numbers, keywords
- Show lexical analyzer recognizing tokens with example
-
7 MarksaExplain briefly about the LEX Compiler.
How to answer
- Define LEX as lexical analyzer generator
- Explain LEX source format: definitions, rules, user subroutines
- Explain working: lex.l to lex.yy.c to a.out with diagram
-
7 MarksbWrite in detail about operator precedence parsing.
How to answer
- Define operator precedence grammar and precedence relations
- Explain precedence table and stack implementation
- Explain shift-reduce parsing steps with example
-
7 MarksaCheck whether the given grammar $G: S \to L=R / R$ $L \to *R/id$ $R \to L$ is SLR(1) is correct. Explain the reasons.
How to answer
- Augment grammar and construct LR(0) canonical collection
- Compute FIRST/FOLLOW and SLR(1) table
- Check for shift-reduce/reduce-reduce conflicts to decide SLR(1)
-
7 MarksbConstruct CLR parsing table for the grammar G $E \to E+T/T$ $T \to T*F/F$ $F \to (E)/id.$
How to answer
- Augment grammar and construct LR(1) canonical collection
- Compute lookaheads and CLR parsing table ACTION/GOTO
- List states, transitions and table entries
-
7 MarksaExplain bottom up evaluation of L-attributes with an example.
How to answer
- Define L-attributed definition and dependency
- Explain depth-first bottom-up traversal with parse tree
- Illustrate evaluation with example
-
7 MarksbDifferentiate between S-attributed definition and L-attributed definition.
How to answer
- Define S-attributed: only synthesized attributes
- Define L-attributed: synthesized + inherited with left-to-right restriction
- Compare on evaluation order, parse tree traversal, implementation
-
7 MarksaWrite the syntax directed translation scheme for case statements.
How to answer
- Define syntax directed translation for switch-case
- Give grammar for case statement with labels
- Write semantic actions for jump labels and code generation
-
7 MarksbConstruct Quadruples, triples and indirect triples for the given expression: $a+a*(b-c)+(b-c)*d.$
How to answer
- Generate three-address code for $a+a*(b-c)+(b-c)*d$
- Construct quadruples table with op, arg1, arg2, result
- Construct triples and indirect triples with pointers
-
7 MarksaDifferentiate between static and Dynamic storage allocation strategies.
How to answer
- Define static allocation: compile-time binding, stack/static area
- Define dynamic allocation: heap, runtime allocation/deallocation
- Compare on lifetime, efficiency, recursion support, overhead
-
7 MarksbDefine Symbol table. Explain the various data structures used to implement the Symbol table.
How to answer
- Define symbol table purpose in compilation
- Explain list, hash table, tree implementations
- Explain operations: insert, lookup, scope management
-
7 MarksaExplain loop optimization technique with an example.
How to answer
- Define loop optimization: code motion, induction variables, strength reduction
- Explain with example loop moving invariant out
- Show before-after three-address code
-
7 MarksbExplain the following optimization techniques:
- i)Common subexpression elimination
- ii)Code Motion
- iii)Variable Propagation
- iv)Strength reduction
How to answer
- Define each technique with purpose
- Give example three-address code for each
- Explain effect on execution time and code size
-
14 MarksWrite short notes on any two of the following:
- i)Capabilities of CFG
- ii)Steps to compute FIRST and FOLLOW
- iii)Dependency graph and Back patching
- iv)Basic block construction
How to answer
- Select any two topics with definition and need
- Explain steps/rules with example or diagram
- Mention applications in compiler phases
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