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

CD Assignment2 2024-25

The document outlines an assignment for B.Tech students in the Compiler Design course, detailing ten questions related to parsing techniques, grammar construction, and ambiguity in grammars. It covers topics such as top-down parsing, recursive descent parsing, FIRST and FOLLOW functions, SLR parse tables, and LL(1) parsing tables. Students are required to demonstrate their understanding through examples and construction of parsing tables for given grammars.

Uploaded by

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

CD Assignment2 2024-25

The document outlines an assignment for B.Tech students in the Compiler Design course, detailing ten questions related to parsing techniques, grammar construction, and ambiguity in grammars. It covers topics such as top-down parsing, recursive descent parsing, FIRST and FOLLOW functions, SLR parse tables, and LL(1) parsing tables. Students are required to demonstrate their understanding through examples and construction of parsing tables for given grammars.

Uploaded by

himanshudev8423
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

KIET Group of Institutions

Department of Computer Science & Engineering


B.Tech., V SEM,
Assignment 2 (2024-25) Odd Semester
Compiler Design (BCS-602)

Q. Questio
No. ns
1 Demonstrate the problems associated with top-down parsing with the help of
suitable examples
2 Construct the following grammar after removing left recursion-
S → Aa | b | ε
A → Ac | SAd | ε
3 Explain recursive descent parsing. And Also construct recursive descent parsing
for following grammar:
S -> aAS | c
A -> ba | SB
B -> bA |S
4 Contrast the process to compute FIRST and FOLLOW functions and determine the FIRST
and FOLLOW for all non-terminals present in the following grammar:
'
S  S#
S ABC
A a | bbD
B a | ε
C b | ε
Dc|ε
5 Consider the following grammar
E->E+(E)
E->id
Contrast the SLR parse table for the grammar. Show the actions of the parser for the input
string “id + (id + (id))”.
6 What do you mean by ambiguous grammar? Check whether the following grammar
ambiguous or unambiguous?
E -> E+E | E-E | E*E | E/E | (E) | id
If the above grammar is ambiguous, then create unambiguous version of above grammar.
7 Construct the LL(1) parsing table and parse the input “a*a+a” using following grammar:
E -> TE’
E’ -> +TE’ | ε
T -> FT’
T’ -> *FT’ | ε
F-> a | (E)
8 Construct parsing table for the following grammar using LALR parser:
S -> CC
C -> aC | b
9 Illustrate the shift-reduce parser for the following grammar using the input string
“cabdbac”:
S -> aSa | bSb | cSc | d
10 Explain the ambiguity in grammar. With the help of an example, also explain how the
grammar is made unambiguous using precedence order and associativity among arithmetic
expression.

You might also like