0 votes 0 votes Total number of Handles for $(w=aa)$ in the following grammar ? $S\rightarrow DT$ $D\rightarrow aa$ $T\rightarrow \epsilon$ Compiler Design compiler-design grammar ambiguous-grammar + – Abhishek Malik asked Apr 5, 2018 retagged Jun 20, 2022 by Lakshman Bhaiya Abhishek Malik 1.2k views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments Prashant. commented Apr 5, 2018 reply Follow Share Given Grammar is Ambiguous since for string aa two derivation tree is possible : D $\rightarrow$ aa D $\rightarrow$ DT $\rightarrow$ aaT $\rightarrow aa \epsilon$ That's why it can give either 3 Handle or 1 Handle. 1 votes 1 votes Soumya29 commented Apr 5, 2018 reply Follow Share Thank you, sir :) 0 votes 0 votes Angkit commented Apr 5, 2018 reply Follow Share 2 handles 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes Handle means rhs can be reduced to a matching LHS so in that case D->DT DT->aaT aaT->aa€ SO 3 handles. Sandy Sharma answered Apr 5, 2018 Sandy Sharma comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes It either have one or three $ruthi answered Apr 5, 2018 $ruthi comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes the handle always appears at the top of the stack just before it is identified as the handle. handle will always be reduced to the LHS part of a production. so answer is 3 handle or 1 handle. abhishekmehta4u answered Apr 5, 2018 edited Apr 5, 2018 by abhishekmehta4u abhishekmehta4u comment Share Follow See 1 comment See all 1 1 comment reply Premjeet Prasad commented Nov 22, 2019 reply Follow Share how is D->DT viable, there's no such production in the gramer 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes 3 HANDLE S--->DT ( 1 handle) D---->aa (second handle) T----->NULL (third handle) abhishekmehta4u answered Apr 5, 2018 abhishekmehta4u comment Share Follow See all 0 reply Please log in or register to add a comment.