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 → є and A → a) to parse a string with n tokens?

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 → є and A → a) to parse a string with n tokens? Correct Answer n – 1

Explanation:

Grammar with no epsilon- and unit-production

S → PQ

P → pp

Q → qq

Derive String: ppqq

S → PQ

S → ppQ

S → pppqq

String length = 4

Production needed = 4 – 1 = 3.

Related Questions