Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

ERODE SENGUNTHAR ENGINEERING COLLEGE

An Autonomous Institution
(Approved by AICTE, New Delhi, Permanently Affiliated to Anna University - Chennai
& Accredited by NAAC & National Board of Accreditation (NBA), New Delhi.)
PERUNDURAI, ERODE – 638 057
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

19CS602- Compiler Design / 6th Semester


Assignment 2 – SYNTAX ANALYSIS
Submission Due:
Mapping with Course Outcome: CO2
Mapping with Program Outcome : PO1,2,3,4,5, 6,7,9,10,12, PS02,3

Instructions:
 ANSWER NEATLY AND LEGIBLY on A4 sheets only and not in sheets torn from a book.
 Sketch diagrams wherever relevant. Explain your notations explicitly and clearly.
 An incomplete assignment is not acceptable for submission.
 Once you submit your assignment, you will be expected to answer all the questions there
INDEPENDENTLY. You may be asked to answer any question of the assignment in the class.
 All other instructions as in this and all subsequent assignments also.

1. Explain about ambiguous Grammar with an example


2. Construct a recursive descent parser for the following grammar.
E->E+T|T
T->TF|F
F->F*|a|b
3. Consider the grammar given below
E->E+E|E-E|E*E|E/E|a|b
Obtain leftmost and rightmost derivation for the string a+b*a+b
4. Explain about LL(1) grammars in detail. Also explain about the working of LL(1) parser
with a neat diagram
5. Explain the role of parser in the compiler design.
6. Construct predictive parsing table for the following grammar.
E->TE'
E'->+TE'|e
T->FT'
T'->*FT'|e
F->(E)|id
7. Explain about parse tree with an example.
8. Consider the following grammar
E->TE`
E`->+TE`|e
T->FT`
T->*FT`|e
F->(E)|id
find the FIRST and FOLLOW functions for the above grammar
9. Consider the following grammar
E->E+T|T
T->TF|F
F->F*|a|b
Construct the SLR parsing table and parse the input a*b+a

You might also like