Sunteți pe pagina 1din 3

UNIT III

1. Construct Predictive Parsing table for the following grammar:


S -> (L) / a
L -> L, S/S and check whether the following sentences belong to that grammar or not.
(i) (a,a)
(ii) (a, (a , a))
2.

(iii) (a, ((a , a), (a , a)) ) (16) APRIL/MAY 09


(a) Construct the predictive parser for the following grammar:
S -> (L)|a
L -> L,S|S. (12) MAY/JUNE 2012
(b) Construct the behaviour of the parser on sentence (a, a) using the grammar:
S -> (L)|a

3.

L -> L,S|S. (4)


Check whether the following grammar is SLR (1) or not. Explain your answer with
reasons.
S-> L=R
S->R
L->*R
L->id
R->L (8)
For the grammar given below, calculate the operator precedence relation and the
precedence functions.

4.

E -> E + E | E E | E * E | E / E | E ^ E | (E) | -E | id (8)


Check whether the following grammar is a LL(1) grammar
S -> iEtS | iEtSeS | a
E -> b
Also define the FIRST and FOLLOW procedures. (16)
(a) Consider the grammar given below.
E->E+T
E->T
T->T*F

T->F
F->(E)
F->id. Construct an LR Parsing table for the above grammar. Give the moves of
LR parser on id*id+id.(12) NOV/DEC2012, APRIL/MAY 11, NOV/DEC2011
5. (b) What is a shift-reduce parser? Explain in detail the conflicts that may occur during
shift- reduce parsing. (4) MAY/JUNE 2012
8. Design an LALR Parser for the following grammar and parse the input id=id.
a. S-> L=R/R
L->*R/id
R->L NOV/DEC2013
6. Consider the following grammar
a. S-AS|b
b. A-SA|a.
7. Construct the SLR parse table for the grammar .Shoe the actions of the parser for the
input string abab.. (16) MAY/JUNE 14, APRIL/MAY 09

UNIT II
1. Compare the features of DFA and NFA. Draw the DFA for the augmented regular
expression((/a)b*)* NOV/DEC2012
2. Construct the Minimized DFA for the regular expression. (0+1)*(0+1)10 NOV/DEC2011
3. Draw the DFA for the augmented regular expression (a|b)*# directly using syntax tree.
(12) NOV/DEC2013
4. Draw NFA for the regular expression ab*/ab. MAY/JUNE 14
5. Draw the transition diagram for relational operators and unsigned numbers in Pascal.
APRIL/MAY 11

6. Prove that the following two regular expressions are equivalent by showing that the
minimum state DFAs are same. (i) (a/b)* (ii) (a*/b*)* MAY/JUNE 15
7. Draw a NFA for a*|b*.

S-ar putea să vă placă și