1) What do you mean by Left Recursion? Write down the suitable example for eliminating the same.
2) What do you mean by FIRST and FOLLOW? Describe in detail with suitable example. Write down the essential algorithm.
3) Create Predictive Parsing table for the grammar given below:
S -> (L) / a
L -> L, S/S
and check whether sentences given belong to that grammar or not.
(i) (a,a)
(ii) (a, (a , a))
(iii) (a, ((a , a), (a , a)) )
4)a) Create predictive parser for following grammar:
S -> (L)|a
L -> L,S|S.
(b) Create behaviour of parser on sentence (a, a) using grammar:
S -> (L)|a
L -> L,S|S.
5)(a) Check whether grammar given below is SLR (1) or not. Describe your answer with suitable reasons.
S-> L=R
S->R
L->*R
L->id
R->L
(b) For the grammar given below, compute operator precedence relation and precedence functions.
E -> E + E | E – E | E * E | E / E | E ^ E | (E) |-E | id
6) Check whether following grammar is a LL(1) grammar
S -> iEtS | iEtSeS | a
E -> b
Also explain the FIRST and FOLLOW procedures.
7)(a) Consider the following grammar.
E->E+T
E->T
T->T*F
T->F
F->(E)
F->id.
Create an LR Parsing table for grammar given above. Write down the moves of LR parser on id*id+id.
(b) What do you mean by a shift-reduce parser? Describe in detail the conflicts which may occur during shift-reduce parsing.