2nd Assign
2nd Assign
Department: Department of Computer Engineering & Applications Course: B.Tech (CSE) Year/Semester: IIIRD / IVTH Session: 2013-2014 Time allowed: 10 (days)
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 $
<.
<.
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.