CD

3 views
Skip to first unread message

amol.b

unread,
Feb 12, 2010, 3:39:48 AM2/12/10
to VANI_GATE_CS_2010
Which of the following describes a handle (as applicable to LR-
parsing)
appropriately?
(A) It is the position in a sentential form where the next shift or
reduce operation
will occur
(B) It is non-terminal whose production will be used for reduction in
the next
step
(C) It is a production that may be used for reduction in a future step
along with a
position in the sentential form where the next shift or reduce
operation will
occur
(D) It is the production p that will be used for reduction in the next
step along
with a position in the sentential form where the right hand side of
the
production may be found

I have confusion in option c and d
whether handle is used in context of reduction only?

Mayur Mahrotri

unread,
Feb 12, 2010, 4:10:26 AM2/12/10
to vani_gat...@googlegroups.com
    -Yes

A handle of a sentential form is a substring "x" such that :
– "x" matches the RHS of a production A -> x ; and
– replacing "x" by the LHS A represents a step in the
reverse of a rightmost derivation of s.

Answer is (d) because of the word "next step".

Handle is not exactly a production, it is a substring of a sentential form, which matches the right hand side of any production, and which will be replaced in the next step by the Left hand side of that production.

--
With Regards,
Mayur.
Reply all
Reply to author
Forward
0 new messages