0% found this document useful (0 votes)
50 views

2nd Assign

The document provides an assignment sheet for a Compiler Design course. It includes 15 questions related to compiler design topics like finding FIRST and FOLLOW sets, determining if a grammar is LL(1), LR(0), SLR, or LALR, constructing parsing tables, eliminating left recursion, and demonstrating languages generated by grammars. Students are asked to solve all questions and discuss any issues before the assignment's due date.

Uploaded by

Jyoti Tripathi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

2nd Assign

The document provides an assignment sheet for a Compiler Design course. It includes 15 questions related to compiler design topics like finding FIRST and FOLLOW sets, determining if a grammar is LL(1), LR(0), SLR, or LALR, constructing parsing tables, eliminating left recursion, and demonstrating languages generated by grammars. Students are asked to solve all questions and discuss any issues before the assignment's due date.

Uploaded by

Jyoti Tripathi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment Sheet - II

Department: Department of Computer Engineering & Applications Course: B.Tech (CSE) Year/Semester: IIIRD / IVTH Session: 2013-2014 Time allowed: 10 (days)

Subject Name & Code: Compiler Design (CSE-321)

Max. Marks: 10

Note : Solve all questions. If you have any problem in solving any question, discuss it before last date of submission.

Ques1: Consider the following grammar: S-> XYZ | ZbY | Ya X-> da | YZ Y-> g | Z-> h | Find the FIRST sets and FOLLOW sets for the non-terminal in this grammar. Ques2: Construct LL(1) parse table for the following grammar: S-> aXb X-> gh | ij Ques3: Consider the context free grammar G: S-> AaAb | Bb A-> B-> Find its FIRST and FOLLOW sets. Is G LL(1)? Justify. Ques4: Consider the following grammar: S-> aS | Ab A-> XYZ | X-> cS | Y-> dS | Z-> eS (a) Give LL(1) parsing table for this grammar. (b) Give a leftmost derivation of the string aebb. (c) Show that if we add the production X-> bS that the grammar is no longer LL(1). Ques5: Eliminate the left recursion in the following grammar: S-> A | B A-> Aa | B-> Bb | Sc | Ques6: Let G be the following grammar: S-> A A-> B | BaA B-> bC C-> Cb | Cc | (a) The grammar is not LL(1). Why? (b) Modify G to produce a new grammar G. Show that G is LL(1). Ques7: Consider the following operator precedence matrix and compute the precedence function.

+ * ( ) id $

+ .> .> <. .> .> <.

* <. .> <. .> .> <.

( <. <. <.

) .> .> = .> .>

id <. <. <.

$ .> .> .> .>

<.

<.

Ques8: Frame the Action/Goto table of the following grammar: S-> 1S1 | 0S0 | 10 Ques9: Demonstrate that the following grammar is not LR(0): E-> 1E E-> 1 Ques10: Frame the Action/Goto table of the following grammar: S-> AaAb | BbBa A-> B-> Demonstrate that the grammar is LR(0) or not. Ques11: Frame the Action/Goto table of the following grammar: S-> AS | b A-> SA | a Ques12: Consider the following grammar: S-> L=R | R L-> *R | id R-> L Demonstrate that the grammar is SLR or not. Ques13: Consider the grammar: S-> CC C-> cC | d Show that the grammar is LR(1) or not. Ques14: Consider the grammar: S-> AA A-> aA | b Show that the grammar is LALR or not. Ques15: Consider the grammar: D-> L:T L-> L,id | id T-> integer Construct an LALR parsing table for the following grammar.

You might also like