Supplementary Semester Examination - Summer 2023 Course: B. Tech. Branch: Computer Engineering Semester: VII Subject Code & Name: BTCOC601 – Compiler Design Max Marks: 60 Date: 13/ 07 / 2023 Duration: 3 Hrs. Instructions to the Students: 1. All the questions are compulsory. 2. The level of question/expected answer as per OBE or the Course Outcome (CO) on which the question is based is mentioned in ( ) in front of the question. 3. Use of non-programmable scientific calculators is allowed. 4. Assume suitable data wherever necessary and mention it clearly. (Level/CO) Marks Q. 1 Solve Any Two of the following. A) Explain the various phases of a compiler and their roles in the compilation process. Remember 6 Illustrate the flow of information between these phases. B) Discuss the lexical analysis phase of a compiler. Explain the role of the lexical Remember 6 analyzer and the construction of tokens from the input source code. Understand C) What is syntax analysis? Describe the role of a parser in this phase. Differentiate Application 6 between top-down and bottom-up parsing techniques, providing examples for Remember each.
Q.2 Solve Any Two of the following.
A) Explain the concept of a symbol table in compiler design. Discuss its importance Remember 6 and the information it stores during the compilation process. Understand B) Describe the different types of errors that can occur during compilation. Explain Remember 6 the difference between lexical, syntax, and semantic errors. Provide examples for Understand each. C) Explain constructing syntax trees for simple expressions involving only binary Understand operators + and -. State the use of Leaf and Node in this syntax tree. Apply
Q. 3 Solve Any Two of the following.
A) Discuss the role of semantic analysis in a compiler. Explain how type checking and Remember 6 type inference are performed during this phase. Illustrate with suitable examples. Understand B) Explain the intermediate code generation phase of a compiler. Describe the Knowledge 6 different intermediate representations used and their advantages and Understand disadvantages. C) What is optimization in the context of a compiler? Discuss the importance of Knowledge 6 optimization and provide examples of common optimization techniques used in Understand compilers.
Q.4 Solve Any Two of the following.
A) Describe the code generation phase of a compiler. Explain the different code Understand 6 generation techniques, such as the use of registers and stack allocation. Application B) What are the different types of code optimization techniques? Explain loop Application 6 optimization and its benefits in detail. Provide examples to illustrate your Understand explanation C) Construct a Predictive parsing table for the Grammar Understand 6 E ->E+T | T, T->T*F | F, F->(E) | id. Apply .Q. 5 Solve Any Two of the following. A) Explain the concept of runtime environments in a compiler. Discuss the stack Analyze 6 allocation and heap allocation strategies used to manage memory during program Understand execution. B) Discuss the concept of code generation for control flow statements in a compiler. Remember 6 Understand C) Explain how the assignment statement “position = initial + rate * 60” is grouped Understand 6 into the lexemes and mapped into the tokens passed on the syntax analyzer. Apply *** End ***