464 views

4 Answers

1 1 vote

Bottom up parser follows RMD in reverse

Number of steps in RMD and RMD in reverse will be same

Rightmost Derivation:

  1. $S \Longrightarrow a A b$ (Step 1)
     
  2. $S \Longrightarrow a(a A b) b=a a A b b$ (Step 2)
     
  3. $S \Longrightarrow a a(a A b) b b=a a a A b b b$ (Step 3)
     
  4. $S \Longrightarrow a a a(c) b b b=a a a c b b b$ (Step 4)
     

Hence number of steps$=4$

0 0 votes
bottom up parser uses RMD in reverse but in the context of question we can only need find reduction so it can easily by RMD as RMD=RMD in reverse in case of reduction
so

S=>a(A)b=>a(aAb)b=>aaaAbbb=>aaacbbb
total 4 reductions
Answer:
Position:
Show:

Related questions

3 3 votes
3 3 answers
390
390 views
GO Classes asked Jan 5
390 views
A canonical set of items in an $\operatorname{LR}(0)$ parser is given below:$(1) ~E \rightarrow T .+E$$(2) ~F \rightarrow T$.$(3) ~T \rightarrow i d$On input symbol $+$, ...
3 3 votes
2 2 answers
355
355 views
GO Classes asked Jan 5
355 views
Consider the following snippet of a specialized programming language:printf("Result: %d\n", x+++ y); // Process result /* Update count count = count * 2; */the number...
5 5 votes
4 4 answers
437
437 views
GO Classes asked Dec 6, 2025
437 views
Consider the following grammar.$S \rightarrow X Y \mid a$ $X \rightarrow c X \mid c$ $Y \rightarrow Y b \mid b$ The number of reduction steps taken by a bottom-up parser ...
2 2 votes
2 2 answers
296
296 views
GO Classes asked Jan 5
296 views
Consider the intermediate code given below:(1) x = 10 (2) if x 0 goto (5) (3) x = x + 1 (4) goto (6) (5) x = x - 1 (6) y = xThe number of nodes and edges in the control-...