Which ONE of the following statements about the LR parser hierarchy is TRUE?
B
Step-by-Step Solution
Key idea: The LR parser hierarchy follows a strict subset relationship: .
Step 1: Recall the hierarchy:
- Every LR(0) grammar is SLR(1), but not vice versa
- Every SLR(1) grammar is LALR(1), but not vice versa
- Every LALR(1) grammar is CLR(1), but not vice versa
Step 2: Evaluate each option:
- "Every LALR(1) is SLR(1)": FALSE — LALR(1) is more powerful than SLR(1)
- "Every SLR(1) is LALR(1)": TRUE — SLR(1) LALR(1)
- "Every CLR(1) is LALR(1)": FALSE — CLR(1) is more powerful than LALR(1)
- "LR(0) and SLR(1) are equal": FALSE — SLR(1) is strictly more powerful
Step 3: Only option B is true.
Answer: B