Question
A canonical set of items is given below
On input symbol the set has
Official answer and solution
- Official answer
- D
- From
- Official GATE 2014 answer key
Solution
Examine the actions enabled in the given canonical LR item set for input symbol '<'.
The canonical set of items is:
Examine possible actions on input symbol '':
-
Shift action:
- In , the dot is immediately followed by the terminal symbol ''.
- A shift action in this item is valid only on input symbol '', which transitions to a state containing .
- There is no shift action on ''.
-
Reduce action:
- In , the dot is at the end of the production, representing a reduction by .
- Even if '' is in so that a reduction action is placed under '', there is only one reduce item.
-
Conflicts on '':
- Shift-reduce conflict requires at least one shift and at least one reduce on the same symbol ''. Since there is no shift on '', no shift-reduce conflict exists.
- Reduce-reduce conflict requires two distinct reduce items to reduce on ''. Since there is only one reduce item in the set, no reduce-reduce conflict can exist.
Therefore, on input symbol '', the set has neither a shift-reduce nor a reduce-reduce conflict.
D
Assuming the item shifts on any comparison operator rather than the specific symbol '' after the dot.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2014 Computer Science and Information Technology (CS) Session 1
- Question
- 44 of 65, printed as CS Q.34
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.