0% found this document useful (0 votes)
562 views2 pages

Compiler Design Important Questions

This document outlines important questions about compiler design across 5 units. It covers topics such as the different phases of a compiler like parsing, code generation, and optimization. Specific questions ask about passes in a compiler, data structures, parsing techniques like LL(1) and operator precedence parsing, syntax trees, type checking, memory allocation strategies, code optimization techniques like common subexpression elimination and dead code elimination, and data flow analysis.

Uploaded by

Manshu Shivam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
562 views2 pages

Compiler Design Important Questions

This document outlines important questions about compiler design across 5 units. It covers topics such as the different phases of a compiler like parsing, code generation, and optimization. Specific questions ask about passes in a compiler, data structures, parsing techniques like LL(1) and operator precedence parsing, syntax trees, type checking, memory allocation strategies, code optimization techniques like common subexpression elimination and dead code elimination, and data flow analysis.

Uploaded by

Manshu Shivam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Important Question Of Compiler Design

Unit 1

Imp Q1. What is pass, types , advantage and disadvantage, factor deciding number of passes for a compiler

Q2. Explain each phase of Language Processing System

Q3. Data structure in Compiler Design

Imp Q4 Explain Bootstrapping

Imp Q5 Explain each Phase in detail of Compiler, and what is Symbol Table ?

Imp Q6 Explain Buffering

imp Q7 what is LEX, various components of lexical specification file with example, numerical based on LEX.

Unit 2

imp Q1. Explain about CFG?

imp Q2 Explain in detail Top down parsing

imp Q3 Explain about left Parsing and how to eliminate it and why to eliminate it , numerical based on left
recursion...everything

Q4 Explain LL(1) also look for numerical on it.

Q5 Operator Preceding

Q6 Define Syntax directed definition.

imp Q7 Explain Syntax tree

Q8 s and l attribute

Q9 top- down translation.

Unit 3

Q1 write short notes on type Checking

imp Q2what is type conversion, how it is implemented, explain Implicit and explicit type checking

Q3 what is overloading of function and operations

Q4 what is polymorphic function

Q5 write short notes on runtime memory (short notes mean at least 7 pages)

imp Q6 Describe the storage allocation strategies its limitation , difference between static stack and heap
allocation ,

Q7 what is hashing and different types of hashing technique


Unit 4

Q1 Write down translation scheme to produce quadruples Boolean expression

imp Q2 Describe the backpatching

Q2 what are the procedural call

imp - numerical are important form this unit

imp Q3 design of code generator

Q4 define "basic blocks"

Q5 how CPU registers are allocated while creating machine code

imp Q6 Explain about DAG and advantage and its application

imp Q7 Explain peephole optimization

imp Q8 look for how to construct DAG for a given expression

Unit 5

Q1 short notes on principle source of optimization

imp Q2 explain dead code elimination , local and loop optimization

imp Q3 explain code movement and common subexperssion elimination

Q4 Different types of optimization

Q5 define i) dominators ii) Natural Loops iii) Inner loop iv) preheader

imp Q6 explain briefly data flow equation

Common questions

Powered by AI

Storage allocation strategies include static, stack, and heap allocation. Static allocation reserves memory at compile time, offering fast access but lacking flexibility for dynamic data structures. Stack allocation allows for efficient memory usage and quick allocation/deallocation but is limited to last-in, first-out (LIFO) order, restricting recursive and asynchronous function calls. Heap allocation offers dynamic memory handling, allowing complex data structures and variable lifetimes but incurs overhead in allocation and fragmentation issues, requiring garbage collection .

LL(1) parsers offer significant advantages due to their simplicity and ability to parse languages in linear time. They facilitate clear, unambiguous parsing with minimal backtracking. However, the main drawback is their limitation to languages that can be expressed in LL(1) grammars, which necessitates grammar transformations that might lose ease of understanding or increase complexity. As a result, LL(1) parsers are suitable for grammar forms specifically designed to fit their constraints .

The Symbol Table plays a pivotal role in compiler design, acting as a repository for variable names, scope, type information, and function definitions. It is used throughout different phases of compilation: during lexical analysis to identify identifiers, in syntax and semantic analysis for type checking, and in optimization and code generation for efficient memory allocation and access. A well-structured Symbol Table enables faster lookup and facilitates complex language features like overloading and polymorphism .

The Language Processing System is crucial for translating and executing high-level language programs. It consists of phases such as lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation. Each phase transforms source code into a lower-level representation, validating syntax and semantics, optimizing code, and finally producing machine code, thus facilitating efficient program execution .

Type checking ensures type correctness of program constructs, preventing errors by validating operations across varying data types. Implicit conversions, or coercions, automatically convert data types without programmer intervention, while explicit conversions require explicit instructions from the programmer. Compilers implement type checking by using rules defined in the language specification to enforce type safety, thereby reducing runtime errors .

Dead Code Elimination removes code segments that do not affect the program's outcome, thereby reducing code size and improving execution speed. By analyzing the control flow graph, compilers can identify unreachable or redundant operations that can be removed without altering program functionality. This optimization conserves resources and enhances program efficiency, particularly in environments with constrained computational power .

Left Recursion in grammars presents challenges in top-down parsing methods such as recursive descent parsing, leading to infinite recursion and non-termination issues. It is eliminated by rewriting the grammar rules to convert left-recursive grammars into right-recursive ones, or using algorithms like the LL(1) parser that accommodates modified grammars. This transformation is crucial to ensure efficient and correct parsing of language constructs .

Backpatching is a technique used during intermediate code generation to manage forward jumps in procedural calls. It involves placeholders in code that are filled in once target addresses are known. This allows compilers to handle constructs like loops and conditional statements where targets are defined only after their first reference is made, hence enabling efficient and flexible procedural call execution without requiring the entire code structure to be known initially .

Compiler passes can be broadly categorized into single-pass, multi-pass, and two-pass compilers. The choice of passes influences efficiency and error detection capability. In a single-pass compiler, the source code is read only once, limiting extensive error checking and optimization. Multi-pass compilers read the source code multiple times, allowing for more comprehensive analysis and optimization. The number of passes is determined by factors such as machine architecture, complexity of the source language, and the need for optimization and error checking .

Dominators in a control flow graph are nodes that must be traversed to reach any node in the graph, providing a basis for optimization techniques such as loop invariant code motion, which relocates computations outside of the loop structure for efficiency. Understanding dominator relationships helps in identifying redundant computations and optimizing loop structures, thereby enhancing execution efficiency and reducing computational overhead associated with unnecessary calculations .

You might also like