718 views
4 votes
4 votes

What is the maximum number of reduce moves that can be taken by a bottom up parser for a grammar without epsilon and unit production (i.e., of type A →∈ and A →B ) to parse a string with n tokens?

  1.   2n – 1
  2.    2n
  3.    n – 1
  4.    n/2

1 Answer

2 votes
2 votes
Here they asked about max no of reduce moves and condition imposed is No epsilon or Unit production

So either we can have combination of terminals or nonterminalor both in RHS of production

For max no of reduce moves we need min no of entry at RHS

So in that case if we have two nonterminal or a terminal in RHS of production it needs maximum no of reduce move.

So the grammar should be in CNF form

So Max no of reduce moves=2n-1

Related questions

1 votes
1 votes
0 answers
1
junaid ahmad asked Dec 20, 2018
628 views
An $\epsilon$ free LL(1) grammar is also a SLR(1) and hence LALR(1) and LR(1) too.Is this statement true ?
0 votes
0 votes
2 answers
2
0 votes
0 votes
1 answer
4
Ana_101 asked 4 days ago
52 views
S - A BA - f S fA - b b B dB - ƐB - cFirst(S) =First(A) =First(B) =Follow(S) =Follow(A) =Follow(B) =