2 2 votes Consider the following grammar: $(1) ~S \rightarrow a A b$ $(2) ~A \rightarrow a A b$ $(3) ~A \rightarrow c$ The number of reduction steps taken by a bottom-up parser while accepting the string $aaacbbb$ is: Compiler Design goclasses compiler goclasses-cs-dpp goclasses-cs-dpp-day-171 goclasses-compiler-practice-questions numerical-answers + – GO Classes 464 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote Bottom up parser follows RMD in reverseNumber of steps in RMD and RMD in reverse will be sameRightmost Derivation:$S \Longrightarrow a A b$ (Step 1) $S \Longrightarrow a(a A b) b=a a A b b$ (Step 2) $S \Longrightarrow a a(a A b) b b=a a a A b b b$ (Step 3) $S \Longrightarrow a a a(c) b b b=a a a c b b b$ (Step 4) Hence number of steps$=4$ GO Classes answered Jan 5 GO Classes comment Share Follow See all 2 Comments 2 2 Comments reply ahthneeuhl commented Jun 22 reply Follow flag RMD in reverse meaning? 0 0 replyShare Mr-TAGORE commented Aug 15 reply Follow flag Right most Derivation in Reverse order. Reduce the right most non terminal first. In bottom up approach. 0 0 replyShare Please log in or register to add a comment.
0 0 votes 4 JAY_THAKAR answered Jan 5 JAY_THAKAR comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes Ans :- 4 binaryXninja answered Feb 24 binaryXninja comment Share Follow 0 reply Please log in or register to add a comment.
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 Aman Shukla answered Apr 4 Aman Shukla comment Share Follow 0 reply Please log in or register to add a comment.