Linked answer questions
Statement for Linked Answer Questions 52 and 53:
For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. is the empty string, indicates end of input, and separates alternate right hand sides of productions.
| Non-terminal | |||
|---|---|---|---|
| E1 | E2 | ||
| error | |||
| E3 |
Shared with question 52.
Question
The appropriate entries for E1, E2, and E3 are
Official answer and solution
- Official answer
- C
- From
- Official GATE 2012 answer key
Solution
Populate LL(1) parsing table cells for non-terminals S on a (E1), S on b (E2), and B on end-of-input (E3).
- LL(1) table construction rules:
- For , add to for all .
- If , add to for all .
- For cell (entry E1):
- has , so add .
- has . Since , also add .
- Thus, E1 contains: .
- For cell (entry E2):
- has , so add .
- has , so add .
- Thus, E2 contains: .
- For cell (entry E3):
- has .
- Because , we look at , which contains .
- Therefore, add to .
- Thus, E3 contains: .
- Combining E1, E2, E3 matches option (C).
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2012 Computer Science and Information Technology (CS)
- Question
- 53 of 65, printed as CS Q.53
- 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.