Assignment No 1 Compiler Design Assignment
Assignment No 1 Compiler Design Assignment
Set assigned
S.no Roll Name Set assigned S.no Roll Name Set
assigned
1 22ESKCS300 Nitisha Vijay I 35 23ESKCS215 Nityam Kaushik X
2 22ESKCS301 Tanishka Jain 36 23ESKCS216 Priyansh
Khandelwal
3 22ESKCS302 Abhinav Soni 37 23ESKCS217 Riddhi Jangid XI
4 22ESKCS303 Tanisha Khandelwal 38 23ESKCS218 Sonali Sharma
5 22ESKCS304 Shreya Samariya II 39 23ESKCS219 Sudhansh Jain XII
6 22ESKCS838 Vikas 40 23ESKCS220 Suruchi Bharti
7 22ESKCS839 Vikas Maur 41 23ESKCS221 Tanishka Sain
8 22ESKCS840 Vikas Singh Gurjar 42 23ESKCS222 Utkarshika Jangid
SET- I
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
QN. Question BL CO MM
What are the various phases of compiler? Explain the functions of each
Q1. phase with its input and output for example statement
3 1 10
A = X*Y.
What is Top-Down parser in syntax analysis? Generate the parse tree for the
Q3. givengrammar G:
G: EE+E | E-E | E*E
Eid 4 2 10
Also verify that the given word w=id + id * id belongs to the given grammar
or not,using top-down parsing? Also generate the parse tree for the given
string.
Q4. G: EBB
BcB
4 2 10
Bd
Find the LR(0) parsing table and verify that the input “ccdd” is parsed with
LR(0) Grammar or not. Specify all necessary steps in LR(0) algorithm.
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
SET- II
QN. Question BL CO MM
Analyze the role of lexical analyzers in a compiler's front-end by examining
Q1. its interaction with the syntax analyzer. How does the recognition of tokens 3 1 10
impact the overall efficiency of the compilation process?
Given a set of tokens and their definitions, apply the process of token
recognition to manually simulate the output of a lexical analyzer for a 3
Q2. 1 10
specific input program
and verify that the input “xaxqyy” is parsed with LR(0) Grammar or not.
Specify all necessary steps in LR(0) algorithm
Q4. G: EE +T | T
TT * F | F
4 2 10
F (E) | id
SET- III
QN. Question BL CO MM
Analyze how error handling in the lexical analysis phase can impact the
Q1. overall performance of the compiler. Provide examples of common errors
3 1 10
and explain the strategies used to recover from them.
Apply the concept of input buffering in lexical analysis to optimize token
recognition for a given source program. Explain how the use of buffering 3
Q2. improves efficiency 1
10
Write the steps to remove the left recursion and design LL(1) predictive
Q3. parser for the following Grammar:
4 2 10
G: E E + E | E – E | E * E | E\E | (E) / id
Consider the following grammar G:
G: SL = R
Q4. S R
L*R 4 2 10
Lid
RL
Compute FIRST and Follow for each non-terminal.
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
SET- IV
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
QN. Question BL CO MM
Using a real-world example, apply the phases of a compiler to demonstrate
Q1. how code is translated from a high-level language to machine code, focusing 3 1 10
on the lexical and syntax analysis phases.
Q4. G: SCC
CcC | d 4 2 10
SET- V
QN. Question BL CO MM
Apply the concept of input buffering in lexical analysis to optimize token
Q1. recognition for a given source program. Explain how the use of buffering 3 1 10
improves efficiency.
SL=R|R
L *R | id
4 2 10
RL
Is the word id = *id parsed from the above grammar. Specify the all steps of
CLR parsing
Q4.
SET- VI
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
QN. Question BL CO MM
Analyze the impact of using a lexical analyzer generator like LEX on the
Q1. development of compilers and discuss its advantages over manual 3 1 10
implementation.
Q4. E TE’
E’+E | E
T FT’
T’T | €
4 2 10
FPF’
F’*F’ | €
F(E) | a | b | €
Compute FIRST and Follow for each non-terminal. Construct the predictive
parsing table for that. Also check the given grammar is LL(1) or not.
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
SET- VII
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
QN. Question BL CO MM
Illustrate the Analysis and Synthesis phase of compiler also categories all
Q1. phases of compiler according to their functioning. 3 1 10
Consider the following grammar G and Design the LL(1) parser with parsing
table and parse tree for given input string id+id*id
Q4.
E TE’
E’+TE | €
4 2 10
T FT’
T’ *FT’ | €
F (E) | id
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
SET- VIII
QN. Question BL CO MM
Analyze the differences between compilers and interpreters in terms of their
Q1. working principles, advantages, and disadvantages. 3 1 10
Compute FIRST and Follow for each non-terminal. Construct the predictive
parsing table for that. Also check if the given grammar is LL(1) or not.
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
SET- IX
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
QN. Question BL CO MM
Illustrate how the below input gets processed in compiler through each
Q1. phase with proper diagram along with the entries in Symbol Table through
symbol table management. 3 1 10
x=y+z*10
Q4. E TE’
E’ +TE’ | €
T FT’
T’ *FT’ | € 4 2 10
F (E) | id
Construct Recursive Descent Parser for input string id+id
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
SET- X
QN. Question BL CO MM
Analyze the relationship between the lexical analyzer and parser also
Q1. illustrate the steps of how a lexical analyzer is implemented? 3 1 10
Categorize the different Error Recovery modes in the parsers. Also explain
how error handling is performed in parsers. 4 2 10
Q4.
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
SET- XI
QN. Question BL CO MM
Apply the concept of Cross Compiler to explain how a simple cross compiler
Q1. could be built using a pre-existing compiler that runs on one machine and 3 1 10
provides machine code for another machine. Provide an example.
SET- XII
Swami Keshvanand Institute of Technology, Management & Gramothan, Jaipur
Department of Computer Science & Engineering
Session 2024_25
Subject: Compiler Design (5CS4-02)
Max Marks- 40
QN. Question BL CO MM
Apply the techniques of error handling in compilers to detect and report
Q1. lexical and syntactic errors in a given program and also explain the symbol 3 1 10
table management.
3 1 10
Q3.
Categorize the different parsing techniques with proper hierarchical 4 2 10
diagram.
Q4. E E+E
E E*E
4 2 10
E id
Evaluate Shift Reduce Parsing for the given input string id1+id2+id3.