Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views1 page

Compiler Design Work Sheet (May, 2025)

This document is a self-test exam worksheet for students in the Compiler Design course at Madda Walabu University. It includes 13 questions covering various topics such as lexical and syntax analysis, parsing techniques, grammar ambiguity, and predictive parsing tables. The questions require students to demonstrate their understanding of compiler design concepts through derivations, parse trees, and error recovery actions.

Uploaded by

Tedy Shimelis
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)
16 views1 page

Compiler Design Work Sheet (May, 2025)

This document is a self-test exam worksheet for students in the Compiler Design course at Madda Walabu University. It includes 13 questions covering various topics such as lexical and syntax analysis, parsing techniques, grammar ambiguity, and predictive parsing tables. The questions require students to demonstrate their understanding of compiler design concepts through derivations, parse trees, and error recovery actions.

Uploaded by

Tedy Shimelis
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
You are on page 1/ 1

MADDA WALABU UNIVERSITY

DEPARTMENT OF COMPUTER SCIENCE


COMPILER DESIGN WORK SHEET
May, 2025

▪ Instruction
❖ Do The Following Self-Test Exam Questions 1-13 Properly.
PART I
1. Why lexical and syntax analyser are separated out?
2. What is ambiguous grammar?
3. What is recursive decent parsing?
4. What are the possible error recovery actions in lexical analyser?
5. What is function of parser?
6. Differentiate top-down parsing and bottom-up parsing
7. Draw NFA and DFA automaton for the given regular expression aa*|bb*.
8. Consider the context- free grammar G.
S → (L)|a
L → L,S|S with the input string ((a,a),a,(a))
a. Give the leftmost derivation for the string.
b. Give the rightmost derivation for the string.
c. Give the parse tree for the string.
d. Is the grammar ambiguous or unambiguous? Justify your answer.
9. Consider the following grammar G:
S→A
A → A + A | B++
B→y
a. Draw the parse tree for the input “ y+++y++”.
10. Let G be the following grammar G:
S → [ SX ] | a
X → ε | +SY | Yb
Y → ε | -SXc
a. Find FIRST and FOLLOW sets for the non-terminals in this grammar.
b. Construct predictive parsing table for the grammar above.
c. Show a top-down parse of the string [a+a-ac]
11. Consider the following grammar G:
S → ScB | B
B → e | efg | efCg
C → SdC | S
a. Justify whether the grammar is LL(1) or not?
b. If not, translate the grammar into LL(1).
c. Construct predictive parsing table for the above grammar.
12. Consider the following grammars G, parse the input string w= id + id * id.
E → TE’
E’ → +TE’ | 
T → FT’
T’ → FT’ | 
F → ( E ) | id
13. Given the following Grammar G:
A → SS
S → aS | b
a. Construct the SLR parsing table.
b. Write the action of an LR parse for the following string aabb

You might also like