Consider the following grammar
Consider the following LR(0) items corresponding to the grammar above
Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?
View worked solution
Answer: D
To determine which items appear in the same canonical set of LR(0) items, let us construct the relevant states of the LR(0) parser starting from the augmented grammar:
Let be the initial state containing the item . Let us trace the transitions:
- State :
- State contains . Transitioning on gives State :
- From State , transitioning on gives State :
As we can see, Item (i) is in state , Item (ii) is in state , and Item (iii) is in state . No two of these items appear together in any single set of the canonical collection. Therefore, the correct option is D.
Free practice · Your answers on this page are not saved.
