# GATE1988-10ib

408 views

Consider the following grammar:

• $S \rightarrow S$
• $S \rightarrow SS \mid a \mid \epsilon$

Indicate the shift-reduce and reduce-reduce conflict (if any) in the various states of the LR(0) parser.

recategorized
0

Here  S→  ϵ will take as reduce/ shift action or not effect on LR(0)  DFA??

1 vote
Both conflicts are present .

SR and RR
1
grammar is ambiguous.

The LR(0) DFA is shown below with states labeled as $I_{0}, I_{1}, I_{2}, I_{3}$.

Note : In the DFA, the transition $S\rightarrow \varepsilon$ is same as the transition $S\rightarrow .$ (as it is a reduce move).

The SR conflicts in this DFA are:

a. State $I_{0}$: Shift move on 'a' and a reduce move $S\rightarrow .$

b. State $I_{1}$: Shift move on 'a' and a reduce move $S\rightarrow .$

c. State $I_{2}$: Shift move on 'a' and a reduce move $S\rightarrow .$

(moves on non-terminal symbol 'S' are goto moves and not shift moves).

The RR conflicts in this DFA are:

a. State $I_{1}$: $S\rightarrow .$ and $S\rightarrow S.$

b. State $I_{2}$: ($S\rightarrow S.$ and $S\rightarrow .$ ) , ( $S\rightarrow SS.$ and $S\rightarrow .$ )

–1 vote
only RR conflict

## Related questions

1
598 views
Consider the following grammar: $S \rightarrow S$ $S \rightarrow SS \mid a \mid \epsilon$ Construct the collection of sets of LR (0) items for this grammar and draw its goto graph.
Consider the DFA $M$ and NFA M2 as defined below. Let the language accepted by machine $M$ be $L$. What language machine M2 accepts, if $F2=A$ ? $F2=B$ ? $F2=C$ ? $F2=D$ ? $M=(Q, \Sigma, \delta, q_0, F)$ $M2=(Q2, \Sigma, \delta_2, q_{00}, F2)$ ... $D=\{\langle p, q, r \rangle \mid p \in Q; q \in F\}$
The code for the implementation of a sub-routine to convert positive numeric data from binary to appropriate character string in a $PDP-11$ like machine has been given below Note-that $SP$ is the stack pointer and $R_i$ represents $i^{th}$ ...