CS3501 – Compiler Design
Download Anna University CS3501 Compiler Design previous year question papers and find the syllabus, notes, and exam resources for Semester 5.
CS3501 Previous Year Question Papers
-
April / May 2024
-
November / December 2024
-
November / December 2023
Important Questions - CS3501 Compiler Design
UNIT 1: Introduction to Compilers & Lexical Analysis
Part A (2 Marks)
- Define Lexeme, Token, and Pattern.
- What are the two parts of compilation? (Analysis and Synthesis).
- State the role of Input Buffering and the use of the sentinel character.
- Differentiate between NFA and DFA.
- What is a Cross-compiler?.
Part B (13/16 Marks)
- Explain the Phases of a Compiler with a neat diagram and trace the statement a = b + c * 60.
- Describe the Role of the Lexical Analyzer and its interaction with the parser.
- Explain the algorithm for Minimizing DFA with an example.
- Explain the construction of NFA from a Regular Expression using Thompson's construction.
UNIT 2: Syntax Analysis
Part A (2 Marks)
- Define Left Factoring and Left Recursion.
- What is Handle Pruning?.
- Differentiate between Top-down and Bottom-up parsing.
- What are the conflicts in Shift-Reduce parsing?.
Part B (13/16 Marks)
- Construct an LL(1) Parsing Table for a given grammar and check string validity.
- Explain LR Parsing and construct an SLR Parsing Table for a grammar.
- Discuss the Error Recovery Strategies in parsing.
- Write a short note on YACC tool and its structure.
UNIT 3: Intermediate Code Generation
Part A (2 Marks)
- Differentiate between Synthesized and Inherited attributes.
- What are Three-Address Codes? Mention its types (Quadruples, Triples, Indirect Triples).
- Define Backpatching.
- What is an Annotated Parse Tree?.
Part B (13/16 Marks)
- Explain Syntax Directed Definition (SDD) and types of attributes in detail.
- Discuss the Specification of a Simple Type Checker.
- Explain how Boolean Expressions and Control Flow Statements are translated using backpatching.
UNIT 4: Run-Time Environment & Code Generation
Part A (2 Marks)
- What is an Activation Record? List its components.
- Define Heap Management.
- List the issues in the design of a Code Generator.
- What is Name Binding?.
Part B (13/16 Marks)
- Discuss different Storage Allocation Strategies (Static, Stack, and Heap).
- Explain the algorithm for identifying Basic Blocks and Flow Graphs.
- Describe the design of a Simple Code Generator.
UNIT 5: Code Optimization
Part A (2 Marks)
- What is Peephole Optimization?.
- Define DAG (Directed Acyclic Graph) and its uses.
- What is Dead Code Elimination?.
- State the principal sources of optimization.
Part B (13/16 Marks)
- Explain the Principal Sources of Optimization with examples (Loop, Data Flow, etc.).
- Discuss the algorithm for DAG Construction for a basic block.
- Explain Global Data Flow Analysis and Efficient Data Flow Algorithms.
Most Repeated / High-Weight Questions
Compiler phases with tracing, DFA minimization and NFA conversion, LL(1) and SLR parsing tables, code generation and optimization techniques, data flow analysis.