📅  最后修改于: 2023-12-03 15:12:40.694000             🧑  作者: Mango
A canonical set of items is given below:
S -> L. > R Q -> R.
On input symbol < of L, the set of items that will appear in the set of items generated by the shift of the symbol < is:
(A) L -> L. < R L -> < L . R (B) L -> < L. R Q -> R. (C) Q -> <. R (D) All of the above
The given canonical set of items represents a part of a parsing table constructed for a Context-Free Grammar. Here, S and Q are non-terminals, and L and R are either terminals or non-terminals.
The dot (.) represents the position within a production where parsing is currently focused. In this set of items, dot is used to represent a partially derived sentence.
The arrow (>) is used in shift item to represent the action of shifting onto the symbol appearing after it.
Now, on input symbol < of L, we need to find out the set of items that will appear in the set of items generated by the shift of the symbol <.
Here, we need to look for all items in the canonical set that have a dot immediately before the symbol <. Only those items can be shifted onto the symbol <.
So, the correct option is (B), which has the following item in it:
L -> < L. R
This item can be shifted onto the symbol <, producing the new set of items:
L -> L. < R
So, option (A) is also correct.
In option (C), the dot is already at the beginning of the production, so no shifting is possible.
Therefore, the answer is option (B).