CD |Gate-2013| Compiler Design
1. 12. What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A → є and A → a) to parse a string with n tokens? [GATE – 2013]
Answer : b)
2. Consider the following two sets of LR(1) items of an LR(1) grammar.
X -> c.X, c/d
X -> .cX, c/d
X -> .d, c/d
X -> c.X, $
X -> .cX, $
X -> .d, $
Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE? [GATE – 2013]
- Cannot be merged since look aheads are different.
- Can be merged but will result in S-R conflict.
- Can be merged but will result in R-R conflict.
- Cannot be merged since goto on c will lead to two different sets.
a. 1 only
b. 2 only
c. 1 and 4 only
d. 1,2,3 and 4
Answer : d)