-
Among simple LR (SLR), canonical LR, and look – ahead LR (LALR), which of the following pairs identify the method that is very easy to implement and the method that is the most powerful, in that order
-
- SLR, LALR
- Canonical LR, LALR
- LSR, canonical LR
- LALR, canonical LR
- SLR, LALR
Correct Option: C
In SLR method, we work with LR(0) items where as in CLR(1) we work with LR(1) items. LR(1) item is comprised of two parts-the LR(0) item and a look ahead associated with the item. If we work with LR(1) items instead of using LR(0) items, then every state of the parser corresponds to a set of LR(1) items. When the parser looks ahead in the input buffer to decide whether the reduction is to be done or not the information about the terminals is available in the state of the parser itself which is not in case of SLR parser state. Hence, CLR(1) parser is more powerful than SLR.