edited by
35,311 views
83 votes
83 votes

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

  1. $n/2$
  2. $n-1$
  3. $2n-1$
  4. $2^{n}$
edited by

13 Answers

0 votes
0 votes

Take a+b*c ==5 tokens

                       *

                 /            \

          +                   c

     /          \

a               b

 

4 reductions

 

Hene answer is (B) n-1

Answer:

Related questions