Skip to content
GATEiit

GATE CSE 2020 Q34: Reduction steps of a bottom-up parse of aaadbbb

Question

Consider the following grammar.

S→aSB∣dS \to aSB \mid d B→bB \to b

The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbbaaadbbb is _______.

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 7 (official GATE 2020 final answer key)

Concept used: Each reduction in a bottom-up parse corresponds to one production used in the rightmost derivation.

First step: Write the derivation of aaadbbbaaadbbb: count the uses of S→aSBS \to aSB, S→dS \to d and B→bB \to b.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2020 CS question paper and final answer key, organised by IIT Delhi. Question paper · Answer key