MAHARAJA SURAJMAL INSTITUTE OF TECHNOLOGY
DEPARTMENT OF INFORMATION TECHNOLOGY
Assignment-1 (CO1)
Faculty Name: Mr. Akshay Singh Class / Semester: IT-1 / 5th
Subject Name: Compiler Design Topic / Unit: 1
Subject Code: CIC-303 Total Marks: 40
Date of Issue: 30/08/2024 Submission Date: 09/09/2024
Q1. Find out the number of tokens in the given code: (Understand) [2+3 marks]
(i) for (int i = 1 ; i <= 10 ; i ++)
(ii) int main )(
}
X=y+z;
I nt x , y , z
Printf ( “ Sum %d %d ” , x ) ;
{
Q2. Describe the Analysis – Synthesis Model of compilation with block diagram. (Remember) [7 marks]
Q3. Write short note on the following: (Remember) [5*3 marks]
(i) Cross Compiler
(ii) Bootstrapping
(iii) Quick and Dirty Compiler
Q4. Differentiate between top-down and bottom-up parsers with example. (Understand) [7 marks]
Q5. Explain the terms token, lexeme and pattern using suitable examples (Remember) [6 marks]
MAHARAJA SURAJMAL INSTITUTE OF TECHNOLOGY
DEPARTMENT OF INFORMATION TECHNOLOGY
Assignment-2 (CO2)
Faculty Name: Mr. Akshay Singh Class / Semester: IT-1 / 5th
Subject Name: Compiler Design Topic / Unit: 2
Subject Code: CIC-303 Total Marks: 40
Date of Issue: 25/09/2024 Submission Date: 08/10/2024
Q1. Write short note on the following: (Remember) [2*3 marks]
(i) LEX
(ii) YACC
(iii) PLY
Q2. How do you eliminate ambiguity from a grammar? Explain with an example. (Apply) [6 marks]
Q3. Write short notes on following: (Remember) [4*3 marks]
(iv) Recursive Descent Parsing
(v) Operator Precedence Parsing
(vi) Conflicts in SR Parsing
Q4. Check whether given grammar is LR(0), SLR(1), CLR(1) and LALR(1) or not? (Apply) [4*4 marks]
S®(S)
S®a
MAHARAJA SURAJMAL INSTITUTE OF TECHNOLOGY
DEPARTMENT OF INFORMATION TECHNOLOGY
Assignment-3 (CO3)
Faculty Name: Mr. Akshay Singh Class / Semester: IT-1 / 5th
Subject Name: Compiler Design Topic / Unit: 3
Subject Code: CIC-303 Total Marks: 30
Date of Issue: 28/10/2024 Submission Date: 04/11/2024
Q1. Translate the expression (a+b)*(c+d)+(a+b+c) into (Apply) [6 marks]
(a) Quadruples
(b) Triples
(c) Indirect Triples
Q2. What is SDD and SDTs? What is the role of these in compilation? What is synthesized and Inherited attributes?
What is S-attribute? (Remember) [6 marks]
Q3. What is symbol table? Discuss the various approaches used for organization of symbol table? (Remember)
[6 marks]
Q4. What are the various data structures used for the symbol table implementation? Explain with example.
(Remember) [6 marks]
Q5. What are the various types of errors that may appear in compilation process? Explain the function of error
handling phase of a compiler? (Remember) [6 marks]
MAHARAJA SURAJMAL INSTITUTE OF TECHNOLOGY
DEPARTMENT OF INFORMATION TECHNOLOGY
Assignment-4 (CO4)
Faculty Name: Mr. Akshay Singh Class / Semester: IT-1 / 5th
Subject Name: Compiler Design Topic / Unit: 4
Subject Code: CIC-303 Total Marks: 30
Date of Issue: 04/11/2024 Submission Date: 11/11/2024
Q1. Explain the Code generation issues and algorithm for code generation. (Remember) [6 marks]
Q2 Explain Peephole Optimization with its techniques. (Remember) [6 marks]
Q3. What are the methods available in loop optimization? (Remember) [6 marks]
Q4. What is a basic block? What is a flow graph? (Remember) [6 marks]
Q5. What is meant by constant folding? What do you mean by induction variable elimination? (Remember)
[6 marks]
Quiz – 1
CO – 1
Name: ____________________ Subject: COMPILER DESIGN
Class: _____________________ Subject Code: CIC-303
Enrollment No.: _____________ Total Marks: 05
Q1. Users write the programs in which language?
a. Low-level Language
b. High-Level Language
c. Decimal-Format
d. Middle-Level Language
Q2. Which computer program accepts the high-level language and converts it into assembly language?
a. Interpreter
b. Linker
c. Assembler
d. Compiler
Q3. Which grammar gives multiple parse trees for the same string?
a. Unambiguous
b. Regular
c. Ambiguous
d. All of the above
Q4. In Compiler lexical analyzer is used for?
a. removing comments
b. removing whitespace
c. breaking the syntaxes in the set of tokens
d. All of the mentioned
Q5. Which compiler runs on one machine and generates code for multiple machines?
a. Multipass compiler
b. Cross compiler
c. Optimizing compiler
d. Onepass compiler
Quiz – 2
CO – 2
Name: ____________________ Subject: COMPILER DESIGN
Class: _____________________ Subject Code: CIC-303
Enrollment No.: _____________ Total Marks: 05
Q1. Which tool is used for grouping of characters in tokens in the compiler?
a. Parser
b. Code optimizer
c. Code generator
d. Scanner
Q2. Parsing is categorized into how many types?
a. three types
b. four types
c. two types
d. five types
Q3. Which derivation is generated by the top-down parser?
a. Right-most derivation in reverse
b. Left-most derivation in reverse
c. Right-most derivation
d. Left-most derivation
Q4. Which parser is most powerful in the following parsers?
a. Operator Precedence
b. SLR
c. CLR
d. LALR
Q5. Which phase of the compiler checks the grammar of the programming?
a. Code Optimization
b. Semantic Analysis
c. Code Generation
d. Syntax Analysis
Quiz – 3
CO – 3
Name: ____________________ Subject: COMPILER DESIGN
Class: _____________________ Subject Code: CIC-303
Enrollment No.: _____________ Total Marks: 05
Q1. In the compiler, the function of using intermediate code is:
a. to improve the register allocation
b. to increase the error reporting & recovery.
c. to make semantic analysis easier.
d. to increase the chances of re-using the machine-independent code optimizer in other compilers.
Q2. Which phenomenon happens when the non-terminal on the left side is repeated as the first symbol on the right
side?
a. Left-most derivation
b. Left recursion
c. Left factoring
d. Left parsing
Q3. Which of the following term is used to keep track of the location where the current values of the name are
stored?
a. Register descriptor
b. Address descriptor
c. Allocation descriptor
d. Flag register
Q4. Which of the following is used in various stages or phases of the compiler?
a. Records
b. Program
c. Symbol Table
d. Table
Q5. Which of the following structure has four fields?
a. Parse tree
b. Triples
c. Indirect Triples
d. Quadruples
Quiz – 4
CO – 4
Name: ____________________ Subject: COMPILER DESIGN
Class: _____________________ Subject Code: CIC-303
Enrollment No.: _____________ Total Marks: 05
Q1. Which graph describes the basic block and successor relationship?
a. Control graph
b. DAG
c. Flow graph
d. Hamilton graph
Q2. In how many types of optimization can be divided?
a. two types
b. three types
c. four types
d. five types
Q3. Which method merges the multiple loops into the single one?
a. Constant Folding
b. Loop rolling
c. Loop jamming
d. None of the above
Q4. The execution time of the code depends on?
a. the usage of machine idioms
b. the way the registers are used
c. the orders in which the computations are performed
d. All of the mentioned
Q5. DAG is an abbreviation of?
a. Detecting Acyclic Graph
b. Data Acyclic Graph
c. Dynamic Acyclic Graph
d. Directed Acyclic Graph