Consider the following grammar.
The number of reduction steps taken by a bottom-up parser while accepting the string $aaadbbb$ is ___________.
| Stack | Input | Action | | ------- | ----- | ---------------- | | $aaad | bbb$ | | | $aaaS | bbb$ | reduction S->d | | $aaaSb | bb$ | reduction B->b | | $aaaSB | bb$ | reduction S->aSB | | $aaSb | b$ | reduction B->b | | $aaSB | b$ | reduction S->aSB | | $aSb | $ | reduction B->b | | $S | $ | reduction S->aSB | Note : Skipped shift steps.
In parse tree, all the non terminals are reductions. So total 7 reductions.
64.3k questions
77.9k answers
244k comments
80.0k users