Consider the augmented grammar G: S’-> S S-> EE E-> aE | b The total number of…

Consider the augmented grammar G:
S’-> S
S-> EE
E-> aE | b
The total number of reduce entries in LR(1) parsing table are ______

Answer: 7Answer: 7 reduce entries Explanation: Count every reduce action cell (an "r" entry) in the LR(1) action table. The reduce actions occur in the following…

Attempted by 10 students.

Show answer & explanation

Correct answer: 7

Answer: 7 reduce entries

Explanation: Count every reduce action cell (an "r" entry) in the LR(1) action table. The reduce actions occur in the following states and correspond to these productions of the grammar (using the original nonterminal names):

  • State I3 — reduce S -> EE (1 reduce entry).

  • State I5 — reduce E -> aE (1 reduce entry).

  • State I6 — reduce E -> b (1 reduce entry).

  • State I8 — reduce E -> b on two different lookaheads (2 reduce entries).

  • State I9 — reduce E -> aE on two different lookaheads (2 reduce entries).

Total reduce entries = 1 + 1 + 1 + 2 + 2 = 7.

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…